Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DLL Talk / DLL Problem - Returning Strings

Author
Message
Gamefreak
19
Years of Service
User Offline
Joined: 20th Jun 2004
Location: Cyberspace
Posted: 5th Jul 2007 01:06 Edited at: 5th Jul 2007 21:46
Wasn't really the problem, please see below

Attachments

Login to view attachments
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 5th Jul 2007 15:13
Well, there's the help in the DBPro help technical documents page and the search function at the bottom of the page ('string', 'just this forum', click 'search') - seriously, this question has been asked so many times it's not funny any more.

Gamefreak
19
Years of Service
User Offline
Joined: 20th Jun 2004
Location: Cyberspace
Posted: 5th Jul 2007 16:45 Edited at: 5th Jul 2007 21:47
Wasn't really the problem, please see below.
Gamefreak
19
Years of Service
User Offline
Joined: 20th Jun 2004
Location: Cyberspace
Posted: 5th Jul 2007 19:51 Edited at: 5th Jul 2007 21:54
Darn it, accidentally deleted my message
I was having problems with a function that returned a string and took an integer. The integer passed in was always 0

Im using this for returning strings


The function was


The stringtable entry was:


And I was using this def file (I think):


the function always returned "ERROR"
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 6th Jul 2007 00:01
Ok, seeing as you seem to be having trouble searching on the forums or finding the help in DBPro ...

When returning a string from a plug-in function, the first parameter is always a pointer to the string you are replacing. This must be freed.


The code for DeleteString needs to look something like this:


Note, that your string table is correct - you don't add an extra string parameter to the parameter list.

Gamefreak
19
Years of Service
User Offline
Joined: 20th Jun 2004
Location: Cyberspace
Posted: 6th Jul 2007 00:16 Edited at: 6th Jul 2007 00:17
Ah, I get it now. I though that:

GlobStruct *g_pGlob;
void ReceiveCoreDataPtr( void *cdp )
{
g_pGlob = (GlobStruct *) cdp;
}
DWORD dbpstring(LPSTR pstring)
{
LPSTR pret=NULL;
DWORD dwSize=strlen((LPSTR)pstring );
g_pGlob->CreateDeleteString ( (DWORD*)&pret, dwSize+1 );
strcpy(pret, (LPSTR)pstring);
return (DWORD) pret;
}


which I found on the forums was an alternative to the code that was listed in the Technical Documents Thanks for the help.

Login to post a reply

Server time is: 2024-04-19 17:36:53
Your offset time is: 2024-04-19 17:36:53