Let me stress that I haven't tested that code, and it may not work. It's mainly just an idea on where I'd go if the Win32::API module isn't working. For example, if you don't have access to Inline::C, then this approach doesn't even have a chance of working.use Inline::C; $transbar = "\0"x66; $bardata = "3070202120200000000127203643012"; $rc =0; $track = substr($bardata,0,20) . "\0"; $route = substr($bardata,20,11) . "\0"; $rc = barcode($track,$route,$transbar); print "$transbar \n"; __C__ #include <windows.h> // setup our data structures typedef int (__cdecl *USPS4CB)(char *,char *,char *); HINSTANCE hDLL; USPS4CB lpfnUSPS4CB; //load the DLL hDLL = LoadLibrary("USPS4CB"); if (hDLL != NULL) { //get a pointer to the function we'll call lpfnUSPS4CB = (USPS4CB)GetProcAddress(hDLL, + "USPS4CB"); if (!lpfnUSPS4CB) // problem loading the function { FreeLibrary(hDLL); // here we would kill our perl process or something, cause // loading the library failed // I don't do too much of this, so I'm not quite sure // how to properly fail fatally } } // function for perl to call int barcode(char *track, char *route, char *transbar) { // call the function return lpfnUSPS4CB(track, route, transbar); }
In reply to Re: WIN32-API Purgetory
by assemble
in thread WIN32-API Purgetory
by jkretlow
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |