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
  • 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
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 learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

621 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