Jump to content
  • Advertisement
Sign in to follow this  
Digital_Asphyxia

Patch: Sharing objects between modules [UPDATED]

This topic is 3783 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
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!