Advertisement

Patch: Sharing objects between modules [UPDATED]

Started by February 09, 2008 01:12 AM
1 comment, last by WitchLord 16 years, 9 months ago
Although there is no method to directly share classes between modules (e.g. import) you can share object indirectly through interfaces. Unfortunately there is a small problem that prevents the called method from accessing global variables. I have narrowed the solution down to a single line change and was all current tests passed. -- EDIT -- I've reduced this down to a single line change. I don't have a plain copy of 2.11.2 installed but it's not difficult to change: Open up as_context.cpp and go to CallScriptFunction:
void asCContext::CallScriptFunction(asCModule *mod, asCScriptFunction *func)
{
	// Push the framepointer, functionid and programCounter on the stack
	PushCallState();

	currentFunction = func;
	module = mod;

	...
}

And...
	// Change:
	module = mod;
	// To:
	module = func->module ? func->module : mod;

This should correct all calling of object methods and functions across modules. [**EDIT** Updated source name from .h to .cpp] [Edited by - Digital_Asphyxia on February 13, 2008 11:31:25 AM]
Bump - Updated the change.
Advertisement
Great, thanks.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement