linker option: delayload - why does it work in debug???? 
Author Message
 linker option: delayload - why does it work in debug????

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



Tue, 30 Sep 2003 04:46:48 GMT  
 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



Tue, 30 Sep 2003 05:04:34 GMT  
 linker option: delayload - why does it work in debug????
i think that you forgot to add the 'Delayimp.lib' in the release settings.
It was done for the debug but not for realease.

Bertrand.



Tue, 30 Sep 2003 22:02:58 GMT  
 linker option: delayload - why does it work in debug????
No, that's not the issue. I was just wondering why it would work in
debug mode, but not in release mode. That is, why release builds will
not allow delay-loading of dlls that export data symbols....perhaps
debug builds do not actually delay-load?

On Fri, 13 Apr 2001 16:02:58 +0200, "Bertrand TROLARD"

Quote:

>i think that you forgot to add the 'Delayimp.lib' in the release settings.
>It was done for the debug but not for realease.

>Bertrand.



Sun, 05 Oct 2003 21:00:29 GMT  
 linker option: delayload - why does it work in debug????
It works in both release and debug. You can check if its working in debug
mode by placing break points in dllmain or other entry point of DLLs that
you expect to be delay loaded.

--
Ajay Kalra [MVP - VC++]

Note: Please post all replies to newsgroup only.


Quote:
> No, that's not the issue. I was just wondering why it would work in
> debug mode, but not in release mode. That is, why release builds will
> not allow delay-loading of dlls that export data symbols....perhaps
> debug builds do not actually delay-load?

> On Fri, 13 Apr 2001 16:02:58 +0200, "Bertrand TROLARD"

> >i think that you forgot to add the 'Delayimp.lib' in the release
settings.
> >It was done for the debug but not for realease.

> >Bertrand.



Mon, 06 Oct 2003 01:42:51 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. linker option: delayload - why does it work in debug????

2. Why the socket option TCP_NODELAY dosen't work

3. Has anyone gotten DELAYLOAD to work?

4. Release vs Debug Why does this not work

5. C++/ATL/ADO - Intellisense not working (statement completion options) not working

6. AppWizzard not doing static dll option

7. Missing VC++.NET Compiler and Linker Options tab

8. Q:linker options

9. linker option!

10. VC Linker Options

11. linker option: using /opt:ref with /ZI

12. VC Linker Options

 

 
Powered by phpBB® Forum Software