Skip Menu |

This queue is for tickets about the Win32-API CPAN distribution.

Report information
The Basics
Id: 32424
Status: resolved
Worked: 44 hours (2640 min)
Priority: 0/
Queue: Win32-API

People
Owner: cosimo [...] cpan.org
Requestors: Jim_Kretlow [...] harte-hanks.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



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.
Download win_C&Java.ZIP
application/zip 308.5k

Message body not shown because it is not plain text.

I tried to work out what the problems are, but currently I have problems reproducing the bugs because my current development system (Vista + MSVC9) compiles the library but refuses to load it. I have gone back to every version of Win32::API (even 0.41) but I have the same problem. I will try to install an XP VM and see if that solves the problem. In the meanwhile, I found additional information on the subject. Win32::API short types [http://www.perlmonks.org/?node_id=548285] Compiling C DLLs and using them from Perl [http://eli.thegreenplace.net/2006/12/04/compiling-c-dlls-and-using- them-from-perl/] Win32::API Purgatory from Perlmonks [http://www.perlmonks.org/?node_id=663116]
On Mar. 29 Gen. 2008 17:51:34, COSIMO wrote: Show quoted text
> I will try to install an XP VM and see if that solves > the problem.
I didn't install XP, but I tried to get Win32::API to load. And I made it compiling my own perl 5.10 from sources with MSVC9. Probably, using Strawberry or ActivePerl is not going to work if you then use MSVC9. Ok, lesson learned for me. Even with this shiny new perl 5.10, Win32::API now loads but Jim example doesn't work neither with Win32::API 0.47, nor with Win32::API 0.41. Other possible tracks to follow: - Research the cause of the problem trying to interface the simplest possible DLL. - Install MSVC8 (2005) or MSVC++ 2003 and see if that helps. - Try with XP instead of Vista and see if that helps. I can only try with Express versions, since I don't own any MS compiler license. And also, I don't want to screw up my laptop wiping out the current system to install XP. This is my personal machine, which I happen to use for development also... :(
I think Win32::API 0.48, just published on CPAN, solves this problem. I have been able to run your example and see the correct code produced. However, you will have to change your sample code like the following: $dll = new Win32::API( "USPS4CB", "USPS4CB", ['P','P','P'], 'I', '_cdecl' ); Please tell me if this work also for you. I currently tested this with Vista and MSVC 2008 Express.
Subject: Re: [rt.cpan.org #32424] Perl 5.10 WIN32-API 0.47 fails to load external DLL
Date: Wed, 20 Feb 2008 17:21:17 -0500
To: bug-Win32-API [...] rt.cpan.org
From: Jim_Kretlow [...] harte-hanks.com
Cosimo, The new release has not become available yet (at least it does not display in newest release) , but I will test it as soon as I find it. Thanks Jim Kretlow Systems Analyst Marketing Services, Jacksonville Harte-Hanks Direct Marketing Phone: 904-519-1463 Fax: 904-363-6867 We make it happen. "Cosimo Streppone via RT" <bug-Win32-API@rt To .cpan.org> Jim_Kretlow@harte-hanks.com cc 02/20/2008 04:52 PM Subject [rt.cpan.org #32424] Perl 5.10 WIN32-API 0.47 fails to load Please respond to external DLL bug-Win32-API@rt. cpan.org <URL: http://rt.cpan.org/Ticket/Display.html?id=32424 > I think Win32::API 0.48, just published on CPAN, solves this problem. I have been able to run your example and see the correct code produced. However, you will have to change your sample code like the following: $dll = new Win32::API( "USPS4CB", "USPS4CB", ['P','P','P'], 'I', '_cdecl' ); Please tell me if this work also for you. I currently tested this with Vista and MSVC 2008 Express.
On Mer. 20 Feb. 2008 17:26:21, Jim_Kretlow@harte-hanks.com wrote: Show quoted text
> Cosimo, > The new release has not become available yet (at least it does not
display Show quoted text
> in newest release) , but I will test it as soon as I find it. > Thanks > > Jim Kretlow > Systems Analyst
Hi Jim, any news on this?
Subject: Re: [rt.cpan.org #32424] Perl 5.10 WIN32-API 0.47 fails to load external DLL
Date: Mon, 6 Oct 2008 14:51:55 -0400
To: bug-Win32-API [...] rt.cpan.org
From: Jim_Kretlow [...] harte-hanks.com
I installed Perl 5.10 Binary build 1004 [287188] provided by ActiveState http://www.ActiveState.com Built Sep 3 2008 13:16:37 And it worked fine. Thank you very much! Jim Kretlow Systems Analyst Marketing Services, Jacksonville Harte-Hanks Direct Marketing Phone: 904-519-1463 Fax: 904-363-6867 We make it happen. "Cosimo Streppone via RT" <bug-Win32-API@rt To .cpan.org> Jim_Kretlow@harte-hanks.com cc 10/01/2008 04:21 PM Subject [rt.cpan.org #32424] Perl 5.10 WIN32-API 0.47 fails to load Please respond to external DLL bug-Win32-API@rt. cpan.org <URL: http://rt.cpan.org/Ticket/Display.html?id=32424 > On Mer. 20 Feb. 2008 17:26:21, Jim_Kretlow@harte-hanks.com wrote: Show quoted text
> Cosimo, > The new release has not become available yet (at least it does not
display Show quoted text
> in newest release) , but I will test it as soon as I find it. > Thanks > > Jim Kretlow > Systems Analyst
Hi Jim, any news on this?
This was fixed then. Thanks Jim!