GameMonkey Script

GameMonkey Script Forums
It is currently Mon Nov 20, 2017 3:26 pm

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Sun Jun 06, 2010 6:49 am 
Offline

Joined: Mon May 31, 2010 7:40 am
Posts: 5
Hey guys, I was hoping someone could help me a little, Im getting an access violation reading location *memory address* when I close my program, and it only started after I added a function that returns a string from a gm function.

I searched the forum and came up with this http://www.gmscript.com/gamemonkey/forum/viewtopic.php?f=6&t=138, but didn't manage to apply anything from there that fixed it, either because it won't or because i did it wrong. Either way, this is my code below.

Code:
void getString()
{
   const char *stringresult = 0;
   if (call.BeginGlobalFunction( &machine, "getString" ))
   {
      call.End();
      call.GetReturnedString( stringresult );
   }
   MessageBox (NULL, stringresult, "Script Response:", MB_OK);;
}



GM Script:
Code:
global getString = function()
{
   return "hello how are you?";
};


It all compiles and runs fine, showing the message box with the text "hello how are you?", but as soon as I close the program I get the access violation.
The disassembly shows this '77D659C3 mov eax,dword ptr [esi+4]' if that is any help.


Top
 Profile  
Reply with quote  
PostPosted: Mon Jun 07, 2010 7:08 am 
Offline

Joined: Fri Jan 14, 2005 2:28 am
Posts: 439
I don't get a crash with that same bit of code, so I would suspect it has to do with something else and not these particular lines of code.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group