Ive got a C program that has variable-length string data that is located in a variable that has this declaration:
How can I send the data from buf to a PB DLL?
This is what Im currently doing (which is failing):
Here is my exported sub in a DLL:
There are a couple of related samples i found in POFFS but Ive been going around in loops for hours with this now and I know that anyone fluent in C++ could probably do it in a few minutes!
------------------
Code:
char *buf;
This is what Im currently doing (which is failing):
Code:
[i]// Load the library ...[/i] hLib = LoadLibrary( "PB.DLL" ); if ( hLib == NULL ) { printf("Unable to get handle to pb.dll"); return FALSE; } lpCallDll = (LPFNCALLDLL*)GetProcAddress(hLib, "ExportedSub"); if ( lpCallDll == NULL ) { printf("Unable to locate ExportedSub in pb.dll"); FreeLibrary( hLib ); return FALSE; } [i]Call the DLL sub...[/i] lpCallDll( buf );
Code:
SUB ExportedSub CDECL ALIAS "ExportedSub" (BufData AS ASCIIZ) EXPORT ON ERROR RESUME NEXT OPEN "C:\c2pb.log" FOR APPEND AS #1 PRINT #1, TIME$ & ": DATA=" & BufData CLOSE #1 END SUB
------------------
Comment