How can I export atexit and puts?

Josh Branning lovell.joshyyy at gmail.com
Thu Apr 18 12:08:47 CDT 2019


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



More information about the wine-devel mailing list