February 18, 2004
Is there a way to perform back linking with OPTLINK?

What I'm getting at is that I'd like my executable to export it's symbols so that DLLs loaded at runtime have access to them. I'll be linking DLLs at runtime with LoadLibrary() and the DLL code may have to access symbols in the executable.

GNU ld has an option "--export-dynamic" which tells the linker to export all symbols of the executable so they can be seen by dynamic libraries loaded at runtime. Other linkers I've used, in particular Solaris ld, always perform exporting of symbols by default. Is this how OPTLINK works?

Is there an equivalent switch to "--export-dynamic" available with OPTLINK?

Thanks for the help,
Michael


February 18, 2004
Michael wrote:
> Is there a way to perform back linking with OPTLINK?
> 
> What I'm getting at is that I'd like my executable to export it's symbols so that DLLs loaded at runtime have access to them. I'll be linking DLLs at runtime with LoadLibrary() and the DLL code may have to access symbols in the executable.
> 
> GNU ld has an option "--export-dynamic" which tells the linker to export all symbols of the executable so they can be seen by dynamic libraries loaded at runtime. Other linkers I've used, in particular Solaris ld, always perform exporting of symbols by default. Is this how OPTLINK works?
> 
> Is there an equivalent switch to "--export-dynamic" available with OPTLINK?

This isn't an OPTLINK problem. __declspec(dllexport) the symbols you want to export from the executable, make sure that the header changes this to __declspec(dllimport) when used in the DLL source. You will also need to create an export library from the executable, but I'm not sure how to go about doing this: DLLs are linked and all symbols must be defined (no unresolved symbols, -fno-undefined in GNU ld terms.) Generally speaking, an import library is only created for DLLs.


-scooter