From: Vincent T. <vt...@un...> - 2008-03-03 06:41:19
|
On Sun, 2 Mar 2008, Brian Dessent wrote: > You can also remove the dllimport attribute, and use the fact that the > linker will automatically create a thunk for the function during > linking. The thunk is just a regular function in the .text section of > the executable, so its address is constant and known at link time. But > there is an extra level of indirection, a minor performance hit; > essentially doing this is exactly equivalent to: > > __declspec(dllimport) void my_fct (void); > void my_fct_helper(void) { my_fct() }; > static const Toto toto = { my_fct_helper }; > > ...except that the linker creates the thunk automatically for you. With this helper function, it is indeed working. The problem is that the lib should also work on Linux, so I can't do everything I want (like removing the dllimport declaration)). But with some #ifdef, i can manage that. thank you very much Vincent Torri |