diff options
author | Gurusamy Sarathy <gsar@engin.umich.edu> | 1997-04-25 05:13:30 +1200 |
---|---|---|
committer | Chip Salzenberg <chip@atlantic.net> | 1997-04-27 00:00:00 +1200 |
commit | 8b10511d03f06e2bc36e4d866861ec81d92d48fc (patch) | |
tree | 265dfb3999eea24e01faae92992385a1a5342c9f /win32/perllib.c | |
parent | a28b458ac6445fb6d53a53bab0f347e9b6860ec9 (diff) | |
download | perl-8b10511d03f06e2bc36e4d866861ec81d92d48fc.tar.gz |
Win32 update (three patches)
Signed-off-by: Gurusamy Sarathy <gsar@engin.umich.edu>
Diffstat (limited to 'win32/perllib.c')
-rw-r--r-- | win32/perllib.c | 103 |
1 files changed, 63 insertions, 40 deletions
diff --git a/win32/perllib.c b/win32/perllib.c index 43d84c507b..f40013b577 100644 --- a/win32/perllib.c +++ b/win32/perllib.c @@ -52,46 +52,6 @@ RunPerl(int argc, char **argv, char **env, void *iosubsystem) return (exitstatus); } -/* Register any extra external extensions */ - -char *staticlinkmodules[] = { - "DynaLoader", - NULL, -}; - -EXTERN_C void boot_DynaLoader _((CV* cv)); - -static -XS(w32_GetCurrentDirectory) -{ - dXSARGS; - SV *sv = sv_newmortal(); - /* Make one call with zero size - return value is required size */ - DWORD len = GetCurrentDirectory((DWORD)0,NULL); - SvUPGRADE(sv,SVt_PV); - SvGROW(sv,len); - SvCUR(sv) = GetCurrentDirectory((DWORD) SvLEN(sv), SvPVX(sv)); - /* - * If result != 0 - * then it worked, set PV valid, - * else leave it 'undef' - */ - if (SvCUR(sv)) - SvPOK_on(sv); - EXTEND(sp,1); - ST(0) = sv; - XSRETURN(1); -} - -static void -xs_init() -{ - char *file = __FILE__; - dXSUB_SYS; - newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, file); - newXS("Win32::GetCurrentDirectory", w32_GetCurrentDirectory, file); -} - extern HANDLE PerlDllHandle; BOOL APIENTRY @@ -133,3 +93,66 @@ DllMain(HANDLE hModule, /* DLL module handle */ } return TRUE; } + +/* Register any extra external extensions */ + +char *staticlinkmodules[] = { + "DynaLoader", + NULL, +}; + +EXTERN_C void boot_DynaLoader _((CV* cv)); + +static +XS(w32_GetCurrentDirectory) +{ + dXSARGS; + SV *sv = sv_newmortal(); + /* Make one call with zero size - return value is required size */ + DWORD len = GetCurrentDirectory((DWORD)0,NULL); + SvUPGRADE(sv,SVt_PV); + SvGROW(sv,len); + SvCUR(sv) = GetCurrentDirectory((DWORD) SvLEN(sv), SvPVX(sv)); + /* + * If result != 0 + * then it worked, set PV valid, + * else leave it 'undef' + */ + if (SvCUR(sv)) + SvPOK_on(sv); + EXTEND(sp,1); + ST(0) = sv; + XSRETURN(1); +} + +static +XS(w32_GetLastError) +{ + dXSARGS; + XSRETURN_IV(GetLastError()); +} + +XS(w32_IsWinNT) +{ + dXSARGS; + XSRETURN_IV(IsWinNT()); +} + +XS(w32_IsWin95) +{ + dXSARGS; + XSRETURN_IV(IsWin95()); +} + +static void +xs_init() +{ + char *file = __FILE__; + dXSUB_SYS; + newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, file); + newXS("Win32::GetCurrentDirectory", w32_GetCurrentDirectory, file); + newXS("Win32::GetLastError", w32_GetLastError, file); + newXS("Win32::IsWinNT", w32_IsWinNT, file); + newXS("Win32::IsWin95", w32_IsWin95, file); +} + |