dll - Why doesn't an extern exported function not get exported? -


i have visual studio 2008 solution creating dll. includes static library. learned exported "__declspec( dllexport )" function in static library isn't exposed via dll. current workaround definition file. i'm wondering since declaration needs export why can't have header in dll project following:

__declspec( dllexport ) function(); 

and in source file of static library

 __declspec( dllexport ) function() { ...contents... } 

when static library pulled dll shouldn't definition resolved declaration , declaration cause function exported?

i tried adding extern declaration well.

the problem linker, when building dll, notice nothing in dll calls function , won't include in dll. fact you're marking export doesn't affect linker's decision.

the usual workaround define function in same source file exported function, , call function elsewhere in same module (eg. dllmain). ensure linker includes module defines exported function.

raymond chen has piece on blog.


Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -