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!)
14 I merely took Paul's dl_dlopen.xs, took out extraneous stuff and
15 replaced the appropriate SunOS calls with the corresponding Win32
20 #define WIN32_LEAN_AND_MEAN
32 #endif /* PERL_OBJECT */
36 #include "dlutils.c" /* SaveError() etc */
39 dl_private_init(CPERLarg)
41 (void)dl_generic_private_init(THIS);
45 #define dl_static_linked(x) 0
48 dl_static_linked(char *filename)
51 for (p = staticlinkmodules; *p;p++) {
52 if (strstr(filename, *p)) return 1;
58 MODULE = DynaLoader PACKAGE = DynaLoader
61 (void)dl_private_init(THIS);
64 dl_load_file(filename,flags=0)
69 DLDEBUG(1,PerlIO_printf(PerlIO_stderr(),"dl_load_file(%s):\n", filename));
70 if (dl_static_linked(filename) == 0)
71 RETVAL = (void*) LoadLibraryEx(filename, NULL, LOAD_WITH_ALTERED_SEARCH_PATH ) ;
73 RETVAL = (void*) GetModuleHandle(NULL);
74 DLDEBUG(2,PerlIO_printf(PerlIO_stderr()," libref=%x\n", RETVAL));
75 ST(0) = sv_newmortal() ;
77 SaveError(THIS_ "%d",GetLastError()) ;
79 sv_setiv( ST(0), (IV)RETVAL);
83 dl_find_symbol(libhandle, symbolname)
87 DLDEBUG(2,PerlIO_printf(PerlIO_stderr(),"dl_find_symbol(handle=%x, symbol=%s)\n",
88 libhandle, symbolname));
89 RETVAL = (void*) GetProcAddress((HINSTANCE) libhandle, symbolname);
90 DLDEBUG(2,PerlIO_printf(PerlIO_stderr()," symbolref = %x\n", RETVAL));
91 ST(0) = sv_newmortal() ;
93 SaveError(THIS_ "%d",GetLastError()) ;
95 sv_setiv( ST(0), (IV)RETVAL);
104 # These functions should not need changing on any platform:
107 dl_install_xsub(perl_name, symref, filename="$Package")
112 DLDEBUG(2,PerlIO_printf(PerlIO_stderr(),"dl_install_xsub(name=%s, symref=%x)\n",
114 ST(0)=sv_2mortal(newRV((SV*)newXS(perl_name, (void(*)(CPERLarg_ CV*))symref, filename)));