Daniel Friederich
2006-09-21 01:59:38 UTC
Hi,
I have a dll load order (or actually unload order) problem with omniorb
on Win32 when using DLL's.
In my setup, both my code and omniorb are in two separate DLL's, the exe
is yet another part.
The Corba part works so far as I see without major problems, but when
unloading my dll it crashes.
My problem is that my dll is registering for one of its objects _nil
object to be deleted when omniorb unloads, and this happens after my dll
unloads, so not existing code get called.
Here's a more detailed explanation of what is going on:
a.exe: the main application, unaware of ominorb, loads b.dll dynamically
b.dll: the dll using omniorb. Links to b.dll
omniorb.dll: dll version of omniorb.
- a.exe is loaded.
- LoadLibrary("b.dll") from a.exe
- LoadLibrary("omniorb.dll") (automatically from Windows)
- omniorb dll is loaded
- b.dll is loading.
- obj= b::SomeObject::_nil is created
- b::SomeObject::_nil object is registered to omniorb to be deleted:
omni::registerNilCorbaObject(obj)
- a.exe decides to unload b.dll later on. UnloadLibrary("b.dll")
- b.dll gets unloaded. Code for b::SomeObject gets unmapped, but
b::SomeObject::_nil is not deleted yet :-(
- omniorb dll is unloaded, destructor of no longer loaded b::SomeObject
is called
-> crash
I'm currently using OmniOrb 4.0.4, so there are a more recent versions
out, but I did not see any bug fix which would apply.
Also, does my observations make sense? Is something in my setup not
correct or supported, or how is it supposed to work?
Daniel
I have a dll load order (or actually unload order) problem with omniorb
on Win32 when using DLL's.
In my setup, both my code and omniorb are in two separate DLL's, the exe
is yet another part.
The Corba part works so far as I see without major problems, but when
unloading my dll it crashes.
My problem is that my dll is registering for one of its objects _nil
object to be deleted when omniorb unloads, and this happens after my dll
unloads, so not existing code get called.
Here's a more detailed explanation of what is going on:
a.exe: the main application, unaware of ominorb, loads b.dll dynamically
b.dll: the dll using omniorb. Links to b.dll
omniorb.dll: dll version of omniorb.
- a.exe is loaded.
- LoadLibrary("b.dll") from a.exe
- LoadLibrary("omniorb.dll") (automatically from Windows)
- omniorb dll is loaded
- b.dll is loading.
- obj= b::SomeObject::_nil is created
- b::SomeObject::_nil object is registered to omniorb to be deleted:
omni::registerNilCorbaObject(obj)
- a.exe decides to unload b.dll later on. UnloadLibrary("b.dll")
- b.dll gets unloaded. Code for b::SomeObject gets unmapped, but
b::SomeObject::_nil is not deleted yet :-(
- omniorb dll is unloaded, destructor of no longer loaded b::SomeObject
is called
-> crash
I'm currently using OmniOrb 4.0.4, so there are a more recent versions
out, but I did not see any bug fix which would apply.
Also, does my observations make sense? Is something in my setup not
correct or supported, or how is it supposed to work?
Daniel