Ignore:
Timestamp:
Jan 23, 2007, 4:38:18 PM (16 years ago)
Author:
Sam Hocevar
Message:
  • Added DLL initialisation code for Win32.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • zzuf/trunk/src/libzzuf.c

    r1695 r1701  
    2525#   include <inttypes.h>
    2626#endif
     27#if defined HAVE_WINDOWS_H
     28#   include <windows.h>
     29#endif
    2730#include <stdio.h>
    2831#include <sys/types.h>
     
    3740#include "debug.h"
    3841#include "fd.h"
     42#include "sys.h"
    3943#include "fuzz.h"
     44
     45/* Library initialisation shit */
     46void _zz_init(void) __attribute__((constructor));
     47void _zz_fini(void) __attribute__((destructor));
     48#if defined HAVE_WINDOWS_H
     49BOOL WINAPI DllMain(HINSTANCE, DWORD, PVOID);
     50#endif
    4051
    4152/* Global variables */
     
    97108
    98109    _zz_fd_init();
     110    _zz_sys_init();
    99111
    100112    tmp = getenv("ZZUF_STDIN");
     
    113125}
    114126
     127#if defined HAVE_WINDOWS_H
     128BOOL WINAPI DllMain(HINSTANCE hinst, DWORD reason, PVOID impLoad)
     129{
     130    (void)hinst;   /* unused */
     131    (void)impLoad; /* unused */
     132
     133    switch(reason)
     134    {
     135        case DLL_PROCESS_ATTACH:
     136            _zz_init();
     137            break;
     138        case DLL_PROCESS_DETACH:
     139            _zz_fini();
     140            break;
     141    }
     142
     143    return TRUE;
     144}
     145#endif
Note: See TracChangeset for help on using the changeset viewer.