K
Kythe
Hello,
My apologies if this is a rather basic question, but I've been beating
my head against the wall trying to get Win32::API interfacing to a dll
working, and I've never done this before.
The dll in question is proprietary; however, it's 32 bit, it requires a
32,000-byte memory space, and returns values via parameters, not just
via return values.
Here's the documentation in question:
"The calling program must provide a workspace for mydll.dll. mydll will
do most of its processing & storing of data in this workspace.
Currently, the work space must be at least 32k bytes (bigger won't
help). Visual Basic programs must provide this via the Windows memory
allocation API. 'C' or Pascal programs may provide a pointer to a
memory area. Mydll creates pointers within the work space, so if the
memory is relocated, the work space must be re-initialized. This can
happen with any call, and is signaled by an error return on the call.
Error codes are listed in the "Return Error Codes" section of this
document."
Here's the provided calling procedure for Delphi/Pascal:
Procedure InitializeDataBaseDbSrvr( DatabasePath_Ptr, Password_Pchar:
Pchar; WorkSpace_Ptr: Pointer; WorkSpaceSize_Wrd: Word; Var
SizeUsed_Wrd: Word; Var ErrorReturn: SmallInt );
And here's the PERL code as it stands now:
#!c:\perl\bin\perl.exe
$password = 'xxxxxxxx';
$cwd = 'C:\\Program Files\\MyDllWorkingDirectory\\';
$err_return = 0;
$buffersize = 32000;
use Win32::API;
Win32::API::Struct->typedef('BUFFER', qw(BYTE Buffer[32000])) or die
"$!\n";
my $buff = Win32::API::Struct->new('BUFFER');
$initialize = new
Win32::API("mydll.dll","InitializeDataBaseDbSrvr","CCSNP","V");
$initialize->Call($cwd,$password,$buff,$buffersize,$err_return);
print "$err_return\n";
Right now, Perl is throwing an error dialog "Perl Command Line
Interpreter has encountered a problem and needs to close. We are sorry
for the inconvenience."
I'm kind of tapped out on this right now. Like I said, I haven't used
PERL to import dll functions before, and I'm at wall when it comes to
the documentation and sample scripts.
Any help would be most appreciated!
My apologies if this is a rather basic question, but I've been beating
my head against the wall trying to get Win32::API interfacing to a dll
working, and I've never done this before.
The dll in question is proprietary; however, it's 32 bit, it requires a
32,000-byte memory space, and returns values via parameters, not just
via return values.
Here's the documentation in question:
"The calling program must provide a workspace for mydll.dll. mydll will
do most of its processing & storing of data in this workspace.
Currently, the work space must be at least 32k bytes (bigger won't
help). Visual Basic programs must provide this via the Windows memory
allocation API. 'C' or Pascal programs may provide a pointer to a
memory area. Mydll creates pointers within the work space, so if the
memory is relocated, the work space must be re-initialized. This can
happen with any call, and is signaled by an error return on the call.
Error codes are listed in the "Return Error Codes" section of this
document."
Here's the provided calling procedure for Delphi/Pascal:
Procedure InitializeDataBaseDbSrvr( DatabasePath_Ptr, Password_Pchar:
Pchar; WorkSpace_Ptr: Pointer; WorkSpaceSize_Wrd: Word; Var
SizeUsed_Wrd: Word; Var ErrorReturn: SmallInt );
And here's the PERL code as it stands now:
#!c:\perl\bin\perl.exe
$password = 'xxxxxxxx';
$cwd = 'C:\\Program Files\\MyDllWorkingDirectory\\';
$err_return = 0;
$buffersize = 32000;
use Win32::API;
Win32::API::Struct->typedef('BUFFER', qw(BYTE Buffer[32000])) or die
"$!\n";
my $buff = Win32::API::Struct->new('BUFFER');
$initialize = new
Win32::API("mydll.dll","InitializeDataBaseDbSrvr","CCSNP","V");
$initialize->Call($cwd,$password,$buff,$buffersize,$err_return);
print "$err_return\n";
Right now, Perl is throwing an error dialog "Perl Command Line
Interpreter has encountered a problem and needs to close. We are sorry
for the inconvenience."
I'm kind of tapped out on this right now. Like I said, I haven't used
PERL to import dll functions before, and I'm at wall when it comes to
the documentation and sample scripts.
Any help would be most appreciated!