Sign in to follow this  

Patch: Sharing objects between modules [UPDATED]

This topic is 3595 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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]

Share this post


Link to post
Share on other sites

This topic is 3595 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this