
linker option: delayload - why does it work in debug????
I don't know why it works in debug, but I understand why it doesn't work in
release. The error message actually explains it - delay-loading doesn't work
on exported data. With functions, linker generates stubs which, when they
are called, load the DLL and forward to actual function. This doesn't work
with data obviously because there's no way to intercept access to it.
You seem to be exporting virtual classes from your DLL which requires
exporting a vtable pointer for a class - that's where delay loading stops
working.
--
With best wishes,
Igor Tandetnik
Quote:
> I am trying to use the linker's /DELAYLOAD:library feature.
> In debug builds, it compiles, links, and executes as expected, never
> loading the library if a function is not called. great.
> However, in release builds, I get the following linker error:
> LINK : fatal error LNK1194: cannot delay-load xpcom.dll due to import
> of data symbol "__declspec(dllimport) const MyObject::`vftable'"
> NMAKE : fatal error U1077: 'link' : return code '0x4aa'
> My questions are:
> 1. why does it link and work in debug mode?
> 2. why does it not work in release mode?
> 3. how can I get it to work in release mode?
> Many thanks!
> Ken