3 * Platform: Win32 (Windows NT/Windows 95)
4 * Author: Wei-Yuen Tan (wyt@hip.com)
5 * Created: A warm day in June, 1995
8 * August 23rd 1995 - rewritten after losing everything when I
9 * wiped off my NT partition (eek!)
11 /* Modified from the original dl_win32.xs to work with cygwin32
16 I merely took Paul's dl_dlopen.xs, took out extraneous stuff and
17 replaced the appropriate SunOS calls with the corresponding Win32
22 #define WIN32_LEAN_AND_MEAN
23 // Defines from windows needed for this function only. Can't include full
24 // Cygwin32 windows headers because of problems with CONTEXT redefinition
25 // Removed logic to tell not dynamically load static modules. It is assumed that all
26 // modules are dynamically built. This should be similar to the behavoir on sunOS.
27 // Leaving in the logic would have required changes to the standard perlmain.c code
31 //#include <windows.h>
32 #define LOAD_WITH_ALTERED_SEARCH_PATH (8)
34 typedef HANDLE HINSTANCE;
35 #define STDCALL __attribute__ ((stdcall))
36 typedef int STDCALL (*FARPROC)();
64 #include "dlutils.c" /* SaveError() etc */
69 (void)dl_generic_private_init(aTHX);
73 MODULE = DynaLoader PACKAGE = DynaLoader
76 (void)dl_private_init(aTHX);
79 dl_load_file(filename,flags=0)
85 char win32_path[MAX_PATH];
86 cygwin_conv_to_full_win32_path(filename, win32_path);
87 filename = win32_path;
89 DLDEBUG(1,PerlIO_printf(PerlIO_stderr(),"dl_load_file(%s):\n", filename));
91 RETVAL = (void*) LoadLibraryExA(filename, NULL, LOAD_WITH_ALTERED_SEARCH_PATH ) ;
93 DLDEBUG(2,PerlIO_printf(PerlIO_stderr()," libref=%x\n", RETVAL));
94 ST(0) = sv_newmortal() ;
96 SaveError(aTHX_ "%d",GetLastError()) ;
98 sv_setiv( ST(0), (IV)RETVAL);
105 dl_find_symbol(libhandle, symbolname)
109 DLDEBUG(2,PerlIO_printf(PerlIO_stderr(),"dl_find_symbol(handle=%x, symbol=%s)\n",
110 libhandle, symbolname));
111 RETVAL = (void*) GetProcAddress((HINSTANCE) libhandle, symbolname);
112 DLDEBUG(2,PerlIO_printf(PerlIO_stderr()," symbolref = %x\n", RETVAL));
113 ST(0) = sv_newmortal() ;
115 SaveError(aTHX_ "%d",GetLastError()) ;
117 sv_setiv( ST(0), (IV)RETVAL);
126 # These functions should not need changing on any platform:
129 dl_install_xsub(perl_name, symref, filename="$Package")
134 DLDEBUG(2,PerlIO_printf(PerlIO_stderr(),"dl_install_xsub(name=%s, symref=%x)\n",
136 ST(0) = sv_2mortal(newRV((SV*)newXS(perl_name,
137 (void(*)(pTHX_ CV *))symref,