5 * Created: 21st July 2000
6 * Last Modified: 23rd Oct 2000
7 * Note: !!!Any modification to the xs file to be done to the one which is under netware directory!!!
9 * 23rd Oct - Failing to find nlms with long names fixed - sdbm_file
14 NetWare related modifications done on dl_win32.xs file created by Wei-Yuen Tan to get this file.
27 //function pointer for UCSInitialize
28 typedef void (*PFUCSINITIALIZE) ();
30 #include "dlutils.c" /* SaveError() etc */
35 (void)dl_generic_private_init(aTHX);
39 MODULE = DynaLoader PACKAGE = DynaLoader
42 (void)dl_private_init(aTHX);
46 dl_load_file(filename,flags=0)
52 char* mod_name = filename;
54 //Names with more than 8 chars can't be found with FindNLMHandle
55 //8 - Name, 1 - Period, 3 - Extension, 1 - String terminator
56 char mod_name8[13]={'\0'};
60 unsigned int nlmHandle=0;
62 while (*mod_name) mod_name++;
64 //Get the module name with extension to see if it is already loaded
65 while (mod_name > filename && mod_name[-1] != '/' && mod_name[-1] != '\\') mod_name--;
67 DLDEBUG(1,PerlIO_printf(Perl_debug_log,"dl_load_file(%s):\n", filename));
69 buffer = strdup(mod_name);
70 p = strtok (buffer, ".");
72 nNameLength = (strlen(p)>8)?8:strlen(p);
73 memcpy(mod_name8,p,nNameLength);
74 *(mod_name8 + nNameLength) = '.';
75 *(mod_name8 + nNameLength+1) ='\0';
76 p = strtok (NULL, ".");
80 if ( (nlmHandle = FindNLMHandle(mod_name8)) == NULL )
82 //NLM/NLP not loaded, load it and get the handle
83 if(spawnlp(P_NOWAIT, filename, filename, NULL)!=0)
85 //failed to load the NLM/NLP, this unlikely
86 //If multiple scripts are executed for the first time before running any other
87 //ucs script, sometimes there used to be an abend.
90 case LOAD_CAN_NOT_LOAD_MULTIPLE_COPIES:
91 nlmHandle = FindNLMHandle(mod_name8);
93 case LOAD_ALREADY_IN_PROGRESS:
99 nlmHandle = FindNLMHandle(mod_name8);
107 nlmHandle = FindNLMHandle(mod_name8);
110 //use UCSExt encountered-
111 //initialize UCS, this has to be terminated when the script finishes execution
112 //Is the script intending to use UCS Extensions?
113 //This should be done once per script execution
114 if (strcmp(mod_name,"Perl2UCS.nlp")==0)
116 unsigned int moduleHandle = 0;
117 moduleHandle = FindNLMHandle("UCSCORE.NLM");
120 PFUCSINITIALIZE ucsinit = (PFUCSINITIALIZE)ImportSymbol(moduleHandle,"UCSInitialize");
126 DLDEBUG(2,PerlIO_printf(Perl_debug_log," libref=%x\n", nlmHandle));
127 ST(0) = sv_newmortal() ;
128 if (nlmHandle == NULL)
129 //SaveError(aTHX_ "load_file:%s",
130 // OS_Error_String(aTHX)) ;
131 ConsolePrintf("load_file error : %s\n", mod_name8);
133 sv_setiv( ST(0), (IV)nlmHandle);
142 dl_find_symbol(libhandle, symbolname)
146 DLDEBUG(2,PerlIO_printf(Perl_debug_log,"dl_find_symbol(handle=%x, symbol=%s)\n",
147 libhandle, symbolname));
149 //import the symbol that the dynaloader is asking for.
150 RETVAL = (void *)ImportSymbol((int)libhandle, symbolname);
152 DLDEBUG(2,PerlIO_printf(Perl_debug_log," symbolref = %x\n", RETVAL));
153 ST(0) = sv_newmortal() ;
155 //SaveError(aTHX_ "find_symbol:%s",
156 // OS_Error_String(aTHX)) ;
157 ConsolePrintf("find_symbol error \n");
159 sv_setiv( ST(0), (IV)RETVAL);
166 # These functions should not need changing on any platform:
169 dl_install_xsub(perl_name, symref, filename="$Package")
174 DLDEBUG(2,PerlIO_printf(Perl_debug_log,"dl_install_xsub(name=%s, symref=%x)\n",
176 ST(0) = sv_2mortal(newRV((SV*)newXS(perl_name,
177 (void(*)(pTHX_ CV *))symref,