Subject: | Perl 5.10 WIN32-API 0.47 fails to load external DLL |
Date: | Fri, 18 Jan 2008 10:22:41 -0600 |
To: | bug-Win32-API [...] rt.cpan.org |
From: | Jim_Kretlow [...] harte-hanks.com |
I have been using Perl and the WIN32-API to encode data into barcode
sequences that can be printed.
I have over 100 barcode applications written using different barcoding DLLs
from different barcode software venders.
ActiveState has two versions of Perl available: Version 5.10 and v5.8.8
The ActiveState PPM repository has two versions of the WIN32-API: 0.47 and
0.46
Programs working in Perl 5.8.7 using WIN32-API Version: 0.41 cause the
newer releases
to abort.
One example is:
The United States Postal Service (USPS) has released a
freeware encoder for their new OneCode barcode.
This encoder is a DLL.
The DLL and sample applications are attached
In the USPS IVP program the DLL is invoked this way
char TrackString[21]; /* Input parameter Track String + 1 null*/
char RouteString[12]; /* Input parameter Route String + 1 null*/
char BarString[66]; /* Output parameter Bar String + 1 null */
int RetCode; /* Return code from the usps4cb encoder */
__declspec (dllimport) int USPS4CB( char *TrackPtr, char *RoutePtr, char
*BarPtr);
The following Perl script works perfectly in Perl 5.8.7 using WIN32-API
0.41
use Win32::API; # Allow dynaminc loading of DLLs
$dll = new Win32::API("USPS4CB","USPS4CB",[P,P,P],I);
$transbar = "\0"x66; # Blank out return area
$bardata = "3070202120200000000127203643012";
$rc = 0; # Return code from dll
$track = substr($bardata,0,20) . "\0";
$route = substr($bardata,20,11) . "\0";
$rc = $dll->Call($track,$route,$transbar); # Call DLL
$transbar =~ s/\0.*$//; # remove hex 00 string terminator
print "$transbar \n";
#####
Output is ATTDAATFADDDTDDTFTFFADADFDTDDAFTATTAAATAAFTFADFDTTTFADAFDDATDDTFT
(See attached file: win_C&Java.ZIP)
Jim Kretlow
Systems Analyst
Marketing Services, Jacksonville
Harte-Hanks Direct Marketing
Phone: 904-519-1463
Fax: 904-363-6867
We make it happen.
Message body not shown because it is not plain text.