How can I export atexit and puts?
Hi, I am trying to export atexit and puts using wine, I wrote a spec file, libwinecompat.spec with the following: @ cdecl atexit(ptr) MSVCRT_atexit @ cdecl puts(str) MSVCRT_puts _________________________________________________________________________ I build an ar archive with: winebuild --implib -o libwinecompat.a -E libwinecompat.spec _________________________________________________________________________ I then test using this program ... /* atexit example */ #include <stdio.h> /* puts */ #include <stdlib.h> /* atexit */ void fnExit1 (void) { puts ("Exit function 1."); } void fnExit2 (void) { puts ("Exit function 2."); } int main () { atexit (fnExit1); atexit (fnExit2); puts ("Main function."); return 0; } ____________________________________________________________________________ ...And compile with sudo mv /usr/i686-w64-mingw32/lib/libmsvcrt.a /usr/i686-w64-mingw32/lib/libmsvcrt.a.old i686-w64-mingw32-gcc -nostdlib test.c -lmsvcrt -L. -lwinecompat sudo mv /usr/i686-w64-mingw32/lib/libmsvcrt.a.old /usr/i686-w64-mingw32/lib/libmsvcrt.a _____________________________________________________________________________ I know mingw's msvcrt is not linked and wine's msvcrt is. Unfortuately I still get the following errors: undefined reference to `puts' undefined reference to `atexit' ________________________________________________________________________________ Any help much appreciated, Josh
Hi, I am trying to export atexit and puts using wine, I wrote a spec file, libwinecompat.spec with the following:
@ cdecl atexit(ptr) MSVCRT_atexit @ cdecl puts(str) MSVCRT_puts
_________________________________________________________________________
I build an ar archive with:
winebuild --implib -o libwinecompat.a -E libwinecompat.spec I am not entirely sure of these things myself, but I am surprised you don't get an error at this point. If you want to export a forward then I htink you'll have to write msvcrt.atexit instead of "MSVCRT_atexit".
However, I recommend loading Wine's msvcrt at runtime with LoadLibrary and retrieving the symbols with GetProcAddress. Otherwise you'll have a mess on your hand to make sure you don't accidentally call the Linux or OSX libc instead.
participants (2)
-
Josh Branning -
Stefan Dösinger