Jump to content

  • Log In with Google      Sign In   
  • Create Account


- - - - -

asCModule::Build() now deletes previous scripts before compiling new?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 Schrompf   Prime Members   -  Reputation: 950

Like
0Likes
Like

Posted 03 May 2012 - 11:31 AM

Hello there,

sorry for consuming your time once again, but I'm stuck at a strange AngelScript behaviour and I need a hint from the original author of this source to solve the issue.

I just upgraded from 2.20.3 to 2.23.1. Upgrading was done be simply copying over the new files, removing the one asm-file that seems to be gone, and adding every new source to the solution. Compiles fine, no apparent interface changes, good thing. But suddenly all but one of my scripts are not executed anymore.

I do the following for hundreds of times:

asIScriptModule::AddScriptSection( "module", someCode);
asIScriptModule::Build();

which worked fine in 2.20.3. Now in 2.23.1 most of my script executions end up with an error "function 'prepare" with 'null'" or something. I stepped through the code for some hours and I finally noticed what I think is the problem. Whenever I call Build(), the InternalReset() function at as_module.cpp:196 destroys all my previously compiled script functions before compiling the new one. I end up with three script modules, each with exactly ONE script function inside. All application-registered types, functions, methods are still there, but all but one script functions compiled at startup are gone. What do I need to do to fix this problem?

Thanks for your time!

Bye, Thomas

Edited by Schrompf, 03 May 2012 - 11:32 AM.

----------
Gonna try that "Indie" stuff I keep hearing about. Let's start with Splatter.

Sponsor:

#2 Andreas Jonsson   Moderators   -  Reputation: 3198

Like
0Likes
Like

Posted 03 May 2012 - 12:57 PM

Whenever Build() is called it discards the old content and compiles the new script. This has always been the case.

If you want a module built from multiple script sections then you should add all the script sections first and only call Build() at the end so they will be built together.

Edited by Andreas Jonsson, 03 May 2012 - 01:00 PM.

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

#3 Schrompf   Prime Members   -  Reputation: 950

Like
0Likes
Like

Posted 03 May 2012 - 03:53 PM

As much as I appreciate your work, but I have to disagree. At least in version 2.20.3 you could incrementally add script sections and build all the accumulated script code repeatedly. My software design was based on this assumption, and upto now it worked just fine.

But from your answer I learned that this was an accident, and it won't come back for good. I better get started rewriting the script system to account for this.
----------
Gonna try that "Indie" stuff I keep hearing about. Let's start with Splatter.

#4 Andreas Jonsson   Moderators   -  Reputation: 3198

Like
0Likes
Like

Posted 03 May 2012 - 04:26 PM

What probably happened was that the script functions in previous builds were kept alive by the garbage collector or explicit references, e.g. by a live object that might call the old functions.

This is still true, i.e. even though you discard a module the compiled script is not immediately destroyed unless nobody is referencing it.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS