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 // 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); }