Heh, why not check out the Framework source on my site?
That answers almost any question about interfacing to DBPro you might ask, but stopping short of the DBPro command access.
Ok, I'll answer this one. The answer is 'no...but'.
When you are returning a string from your function, DBPro also passes the string value that you are replacing as the first argument of your function. So you should use CreateDeleteString to remove the old string, and CreateDeleteString to create a new one. Technically, you could re-use the storage of the old string if it was long enough, and pass that back without deleting/creating - but that's usually too much bother and the time saving is minimal.
Here's an extract from the assembly-code plugin I'm currently working on to give you the idea:
EXPORT LPSTR GetAssemblyError(LPSTR OldString)
{
if (OldString)
{
CorePtr->CreateDeleteString( (DWORD*)&OldString, 0 );
}
LPSTR ReturnString = 0;
if (ErrorString)
{
CorePtr->CreateDeleteString ( (DWORD*)&ReturnString, strlen(ErrorString)+1 );
strcpy(ReturnString, ErrorString);
}
return ReturnString;
}
Any other strings that you pass to your function should be considered read-only. You should not change their contents or deallocate them.