Link to home
Start Free TrialLog in
Avatar of eladho
eladho

asked on

Deadlock when linking 2 DLLs that call eachother ?

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.
Elad.

Avatar of jkr
jkr
Flag of Germany image

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
Avatar of eladho
eladho

ASKER

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?
>>Should a .lib be created

Actually, yes.
ASKER CERTIFIED SOLUTION
Avatar of yukapapa
yukapapa

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial