In the earliest versions of Win32::API, you had to be very careful to
pre-allocate memory for pointers and bUffers. While the current
Win32::API appears to "do the right thing" more often, when there was a
mismatch at the call interface you would get errors like the one you
report. Take a good look at the docs. You may need to pass things as a
structure.
-bill
On Fri, 2010-03-19 at 13:18 -0400, Su, Yu (Eugene) wrote:
> I am using Win21::API to call a function in a custom-built DLL
> (mydll.dll) to perform an image analysis.
>
> The C function call is defined as
> int analyzeImage(
> char* outputcsv;
> unsigned short* image;
> unsigned int cols;
> unsigned int rows;
>
> )
>
> My perl codes below seem to work since an expected output is generated.
> However, it always ends up with a fatal pop-up error window:
> "Perl Command Line Interpreter has encountered a problem and needs to
> close. We are sorry for the inconvenience."
>
> Does anyone has any clue what could be wrong causing this pop-up error
> window? The last line of the codes is never being executed.
>
> Thanks for helps.
>
> Eugene
>
>
> ##### code snippet #####
> use Win32::API;
> use strict;
> use warnings;
>
> my $imageFile="C:\\temp\\demo.img";
> my $csv="C:\\temp\\demo.csv";
> my $col=1024; #the image is 1024x1024
> my $row=1024;
>
> my $header;
> my $headerSize=2*1024; # the image has a header of 2k bytes my $image;
> my $imageSize=1024*1024*2; # each pixel is an unsigned short type
>
> open(FH, "+<$imageFile") or die "\nCan not open $imageFile: $!\n";
> binmode(FH); read(FH, $header, $headerSize) == $headerSize or print
> "\nshort read: $!\n"; read(FH, $image, $imageSize) == $imageSize or
> print "\nshort read: $!\n"; close(FH);
>
> my $analyzeImage = Win32::API->new("mydll", "analyzeImage", "PPII",
> "I"); my $status = $analyzeImage->Call($csv,$image,$col,$row);
>
> print "\nStatus: $status";
>
>
>
>
>
>
> _______________________________________________
> Perl-Win32-Users mailing list
> [email protected]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs