Re: Dynamic linking with symbols
- From: Ulrich Eckhardt <eckhardt@xxxxxxxxxxxxxx>
- Date: Wed, 31 Aug 2005 08:52:23 +0200
Philip Lawatsch wrote:
> I have an executable which dllexports a lot of stuff. And a dll which
> dllimports it (yes, _really_ this way around).
>
> The idea is that the dll is a plugin for my exe and thus can use all of
> the "symbols" inside my executable.
IIUC, the executable exports an environment in which the plugin runs, right?
> Now the problem is that in this case the dll has to link against a
> specific executable which in turn makes sure I can't use the same dll in
> two different executables.
Is this intentional or a side-effect you observed?
> Now I could put all the exported code from my executables into a dll and
> let my plugin dll and both of my executables link against this dll.
>
> This way I could use the plugin dll in both executables.
I assume the above was an unwanted side-effect which you want to avoid. One
way would be to let the plugin resolve symbols explicitly, i.e. using
GetProcAddress(). I'm not sure if that is possible, but maybe you could do
that in DllMain() and return a failure value if a symbol is missing. Beware
though, not all operations are possible there, in particular not
LoadLibrary().
> I'd however like to avoid bringing yet another dll into the game and
> thus am looking for a unix like solution. On Linux for instance I can
> simply export the symbols of my executable by name and the dynamic
> loader will link the shared lib against the executable (it will happily
> link against any executable as long as the symbols are there) at runtime.
I don't think the MS Windows runtime linker also resolves reverse
dependencies, which is why you'll have to do it yourself.
Uli
.
- References:
- Dynamic linking with symbols
- From: Philip Lawatsch
- Dynamic linking with symbols
- Prev by Date: Re: _CRTDBG_MAP_ALLOC and atl
- Next by Date: RE: _CRTDBG_MAP_ALLOC and atl
- Previous by thread: Re: Dynamic linking with symbols
- Next by thread: Change Tab Caption Dynamically
- Index(es):
Relevant Pages
|
Loading