Deadlock when linking 2 DLLs that call eachother ?

Posted on 2003-03-17
Medium Priority
Last Modified: 2010-04-02
Now this must be an old problem:
I have very big project that was originally meant solely for Linux.
I now port it also to windows (on the VC++ .NET) and apparently some DLLs call each other.
So, I face a linking problem as no .lib is available (the chicken and the egg problem).
Now this is a huge project. My options, as I see them are:
1) Take off all calls to imported functions inside some DLL, build it, build all rest the same way, then start bringing in the missing calls.
2) Use some sort of dummy lib. The problem is that if such an option really exist- I don't know how to do that.
3) Collide all DLLs into one.

I'll be glad to know if option 2 really exists, or of any other option if you see such.
Dynamically loading the DLL is as bad as option 1 as it requires many changes (each DLL exports hundreds of symbols), so I prefer to stick to the implicit load, and make as little source changes as possible.

Thanx for any help.

Question by:eladho
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 86

Expert Comment

ID: 8151634
Your problem is called "circular references". Th e2 solutions that actually exist are

- resolve the circular references (recommended, but tedious :o)

- initially link the DLLs using the "/FORCE" linker switch, so the import libs will be created regradless whether the DLL itself contains unresolved externals

Author Comment

ID: 8151821
But the /FORCE switch makes that:
"Debug/whirl2c.dll : warning LNK4088: image being generated due to /FORCE option; image may not run"
Meaning a .dll is created and not a .lib (I had a look at the directory also).
How will that aid me in building some another .dll that requires the latter .lib ?
Should a .lib be created or am I missing something perhaps?
LVL 86

Expert Comment

ID: 8151929
>>Should a .lib be created

Actually, yes.

Accepted Solution

yukapapa earned 500 total points
ID: 8156019
Hi eladho.

To solve the circular references, use import libraries and export files. See MSDN library documentation "Using an import library and export file"(http://msdn.microsoft.com/library/en-us/vccore/html/_core_Using_an_Import_Library_and_Export_File.asp?frame=true) for details.


Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
Suggested Courses
Course of the Month13 days, 21 hours left to enroll

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question