Problem creating plugin that returns a string.

Started by aaron524, Mon 25/11/2013 00:12:00

Previous topic - Next topic

aaron524

Hello there!

First time on the form and using AGS. I'm helping a friend by building a small C++ engine plugin for him. I need to pass a string from the C++ plugin to the AGS script.
In the script I have a simple button click event on a close GUI button :
Code: agc

  String content = getBookContent();
  String title = getBookTitle();


In the C++ plugin I have this code:
Code: c++

// get title of book with id
const char *getBookTitle(){
	return engine->CreateScriptString("hello world");
}

// get content of book and page with id
const char *getBookContent(){
    return engine->CreateScriptString("hello world content");
}


Note that these are only tests to see if I can return the string.
But when I run the game and click the button. I get this error:

Quote
---------------------------
Illegal exception
---------------------------
An exception 0xE06D7363 occurred in ACWIN.EXE at EIP = 0x75B4B727 ; program pointer is +6, ACI version 3.21.1115, gtags (5,5)

AGS cannot continue, this exception was fatal. Please note down the numbers above, remember what you were doing at the time and post the details on the AGS Technical Forum.

in "GlobalScript.asc", line 121
from "GlobalScript.asc", line 476


Most versions of Windows allow you to press Ctrl+C now to copy this entire message to the clipboard for easy reporting.

An error file CrashInfo.dmp has been created. You may be asked to upload this file when reporting this problem on the AGS Forums. (code 0)
---------------------------
OK   
---------------------------

I followed a previous post on this topic, but only resulted in this.
Any help is welcome.

Thanks!

monkey0506

I've never returned text from a plugin, but that looks right. AFAIK the CrashInfo.dmp files from AGS 3.2.1 aren't usable to us though because they rely on a PDB file that we don't have. :(

It may not be relevant, but could you also post the header string and the call to RegisterScriptFunction?

Crimson Wizard

Also, what happens "in "GlobalScript.asc", line 121"? Is it "String content = getBookContent();" or something else? Just to clarify.

aaron524

I think I fixed the problem. I created the project in Visual Studio 2012 and imported the files from the example plugin.

I started a new project this time in Visual Studio 2008, and moved it into VS2012 an set the toolset to 2008.

Now everything works fine!

Thanks!

Crimson Wizard

Hmm, now, that's not good.
What are differences between 2008 and 2012? Compilation options?

There was an issue with MinGW compiler, not sure if related: http://www.adventuregamestudio.co.uk/forums/index.php?topic=47766

SpeechCenter

Not sure it's related, it sounds more likely a problem with different runtimes that were used in the engine and the plugin. If that's the case you can expect many different types of problems.

SMF spam blocked by CleanTalk