# Cannot autoload, the autoloader is used for the REXX functions.
+sub new {
+ confess 'Usage: OS2::DLL->new( <file> [<dirs>] )' unless @_ >= 2;
+ my ($class, $file) = (shift, shift);
+ my $handle;
+ $handle = $class->load($file, @_) and return $handle;
+ my $path = @_ ? " from '@_'" : '';
+ my $err = DynaLoader::dl_error();
+ $err =~ s/\s+at\s+\S+\s+line\s+\S+\s*\z//;
+ croak "Can't load '$file'$path: $err";
+}
+
sub load
{
confess 'Usage: load OS2::DLL <file> [<dirs>]' unless $#_ >= 1;
The DLL is not unloaded when the variable dies.
-Returns DLL object reference, or undef on failure.
+Returns DLL object reference, or undef on failure (in this case one can
+get the reason via C<DynaLoader::dl_error()>).
+
+=head2 Create a REXX DLL handle
+
+ $dll = OS2::DLL->new( NAME [, WHERE] );
+
+Same as L<C<load>|Load REXX DLL>, but croaks with a meaningful message on
+failure.
=head2 Check for functions (optional):