diff options
author | Ilya Zakharevich <ilya@math.berkeley.edu> | 2003-12-18 06:10:29 -0800 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2004-01-01 17:29:21 +0000 |
commit | 1933e12cd0d32c774bd7f483285802de52dc8cbc (patch) | |
tree | a2cdc2316a1e9964350869b0754cf42977a94088 /os2/OS2 | |
parent | b08eb2a88581a6164b7fe182bf291c86bfb3c690 (diff) | |
download | perl-1933e12cd0d32c774bd7f483285802de52dc8cbc.tar.gz |
OS/2 update
Message-ID: <20031218221029.GA7898@math.berkeley.edu>
p4raw-id: //depot/perl@22032
Diffstat (limited to 'os2/OS2')
-rw-r--r-- | os2/OS2/REXX/DLL/Changes | 2 | ||||
-rw-r--r-- | os2/OS2/REXX/DLL/DLL.pm | 57 |
2 files changed, 58 insertions, 1 deletions
diff --git a/os2/OS2/REXX/DLL/Changes b/os2/OS2/REXX/DLL/Changes index 874f7fab4a..e2c656dd90 100644 --- a/os2/OS2/REXX/DLL/Changes +++ b/os2/OS2/REXX/DLL/Changes @@ -1,2 +1,4 @@ 0.01: Split out of OS2::REXX +0.02: + New methods libPath_find(), has_f32(), handle() and fullname(). diff --git a/os2/OS2/REXX/DLL/DLL.pm b/os2/OS2/REXX/DLL/DLL.pm index 537a2107fc..5d8a24ea7b 100644 --- a/os2/OS2/REXX/DLL/DLL.pm +++ b/os2/OS2/REXX/DLL/DLL.pm @@ -1,6 +1,6 @@ package OS2::DLL; -our $VERSION = '1.01'; +our $VERSION = '1.02'; use Carp; use XSLoader; @@ -58,6 +58,20 @@ sub load { $load_with_dirs->(@_, @libs); } +sub libPath_find { + my ($name, $flags, @path) = (shift, shift); + $flags = 0x7 unless defined $flags; + push @path, split /;/, OS2::extLibpath if $flags & 0x1; # BEGIN + push @path, split /;/, OS2::libPath if $flags & 0x2; + push @path, split /;/, OS2::extLibpath(1) if $flags & 0x4; # END + s,(?![/\\])$,/, for @path; + s,\\,/,g for @path; + $name .= ".dll" unless $name =~ /\.[^\\\/]*$/; + $_ .= $name for @path; + -f $_ and return $_ for @path; + return; +} + package OS2::DLL::dll; use Carp; @ISA = 'OS2::DLL'; @@ -102,6 +116,16 @@ sub find return 1; } +sub handle { shift->{Handle} } +sub fullname { OS2::DLLname(0x202, shift->handle) } +#sub modname { OS2::DLLname(0x201, shift->handle) } + +sub has_f32 { + my $handle = shift->handle; + my $name = shift; + DynaLoader::dl_find_symbol($handle, $name); +} + XSLoader::load 'OS2::DLL'; 1; @@ -186,6 +210,37 @@ Unless used inside REXX environment (see L<OS2::REXX>), the REXX runtime environment (variable pool, queue etc.) is not available to the called function. +=head1 Inspecting the module + +=over + +=item $module->handle + +=item $module->fullname + +Return the (integer) handle and full path name of a loaded DLL. + +TODO: the module name (whatever is specified in the C<LIBRARY> statement +of F<.def> file when linking) via OS2::Proc. + +=item $module->has_f32($name) + +Returns the address of a 32-bit entry point with name $name, or 0 if none +found. (Keep in mind that some entry points may be 16-bit, and some may have +capitalized names comparing to callable-from-C counterparts.) Name of the +form C<#197> will find entry point with ordinal 197. + +=item libPath_find($name [, $flags]) + +Looks for the DLL $name on C<BEGINLIBPATH>, C<LIBPATH>, C<ENDLIBPATH> if +bits 0x1, 0x2, 0x4 of $flags are set correspondingly. If called with no +arguments, looks on all 3 locations. Returns the full name of the found +file. B<DLL is not loaded.> + +$name has F<.dll> appended unless it already has an extension. + +=back + =head1 Low-level API =over |