Jump to content
  • Advertisement
Sign in to follow this  

Patch: Sharing objects between modules [UPDATED]

This topic is 3957 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

	currentFunction = func;
	module = mod;


	// 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
Sign in to follow this  

  • Advertisement

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!