DLL fun

DJ Delorie dj@delorie.com
Sun Jan 31 23:52:00 GMT 1999


Rui-Tao Dong wrote:
> However, I have one minor problem.  Everytime the framegrabber pops up
> an error message, it goes to the machine with the framegrabber not to
> my local PC.  I tried to do something like
> 
> int __attribute__((stdcall)) MessageBoxA(int handle, char* msg, char* title, int type)

Nice try, but I don't think this will do what you expect.  The problem
is that when DLLs are build against the import libraries of other
DLLs, the final link is done.  By the time you link your application
against that DLL, it's too late to override functions like that.
Each DLL has an "import list" that defines not only the functions
it needs, but which other DLLs they come from.  The only way to override
the function call (like you're trying to do above) is to create a
new DLL with the same name as the one that function is in (like
gdi32.dll), but then you'd have to replicate *all* the functions.

Overriding the function like you're trying to do would only work for
the application in which your override exists.  It won't override
other DLLs your application links against.

DJ
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".



More information about the Cygwin mailing list