DLL Call Follies



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!

.



Relevant Pages

  • Re: The procedure entry point Perl_Glockhook_ptr could not be located in the dynamic link library pe
    ... There's no way to resolve this issue short of upgrading the perl version itself? ... The procedure entry point Perl_Glockhook_ptr could not be located in the dynamic link library perl58.dll ... I spent a whole day trying to what caused and found out ActiveState dll had a wrong version DLL in the 5.8.7 distro ... This e-mail communication and any attachments may contain confidential and privileged information for the use of the ...
    (perl.dbi.users)
  • Re: Win32::API cannot load any DLL?
    ... I've decided to try SWIG as my solution. ... as Ruby to load my dll without any problem. ... I hope you tried to run the script as 'perl msdll.pl' not 'perl msdll.dll' ...
    (comp.lang.perl.misc)
  • Re: Parsing Google-like queries for FT search
    ... but i didn't find any mention of perl in your question. ... SQL2005 you can declare external stored function using win DLL (this was ... true also on SQL2000) and any CLR language. ... I'm planning of testing this way in the next couple of days, ...
    (microsoft.public.sqlserver.fulltext)
  • Re: Problem with Win32::API and pointers
    ... DLL from Perl, ... But it contains the address of a void pointer. ...
    (comp.lang.perl.modules)
  • Problem with Win32::API and pointers
    ... DLL from Perl, ... #Close port ... I thing it should work with the API, because it is pretty much the same ...
    (comp.lang.perl.modules)