Re: Dynamic linking with symbols



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

.



Relevant Pages

  • Re: Cannot activate sbcl
    ... but I think what happens is that Windows sees that your executable has a DATA section that might overlap a DLL's address space then it would reallocate that DLL to different address space. ... VirtualAlloc dynamically in your code is that your program and all its ... What can be done here is to have many tiny executables with different BSS sections in them, which then load a bigger executable in the form of a DLL. ...
    (comp.lang.lisp)
  • Re: Why do we need executables in certain formats ?
    ... > Can anybody explain me why do we need executables in certain formats? ... Modern virtual memory processors can locate to ... ..DLL files changed out from under them, ...
    (comp.lang.asm.x86)
  • Re: Dynamic linking with symbols
    ... And a dll which ... > two different executables. ... Try putting your "exported code" into a static library which your ... EXE links against. ...
    (microsoft.public.vc.language)
  • Re: Dynamic linking with symbols
    ... And a dll which ... >>>two different executables. ... >>>let my plugin dll and both of my executables link against this dll. ... >> EXE links against. ...
    (microsoft.public.vc.language)
  • Re: Dynamic linking with symbols
    ... 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. ... 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. ... EXE links against. ...
    (microsoft.public.vc.language)

Loading