03-17-2005, 02:41 AM
Please be patient, its been several years since I've done anything C\C++ and I am trying to 're-learn'.
How do I get a "string" from a C DLL?
This is the C code I am using to start with (VC++ 6)
I have a def file with my functions.
This is how I am calling the functions in FB.
If I don't use the String Ptr (and use only String) in the Now function it crashes. But with the pointer, I get the address (obvious), when what I want is the content.
Am I way off base with this?
How do I get a "string" from a C DLL?
This is the C code I am using to start with (VC++ 6)
Code:
#include "stdafx.h"
#include <stdio.h>
#include <time.h>
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
int ReportVersion() {
return 1;
}
char *GetDateTime(){
time_t rawtime;
time ( &rawtime );
return ctime (&rawtime);
}
I have a def file with my functions.
This is how I am calling the functions in FB.
Code:
'$inclib: "testdll01.dll"
declare function rVersion cdecl alias "ReportVersion" () as integer
declare function Now cdecl alias "GetDateTime" () as string ptr
? rVersion
? now
sleep
If I don't use the String Ptr (and use only String) in the Now function it crashes. But with the pointer, I get the address (obvious), when what I want is the content.
Am I way off base with this?