Sign in to follow this  
__Avatar__

Question under references

Recommended Posts

Hello. At work above the project with use of your script, we had following situation. Details are lower. By a call of function from AngelScript, registered with the signature of type: void Fn (RefClassName @obj); System AngelScript for obj does AddRef. The citation: -------------- 3. The superfluous amount of calls AddRef and Release can be reduced if to have the additional information on links between two and more cells of memory. ... The typical situation to which the rule about the additional information is applicable, arises by transfer of indexes of interfaces to functions as to parameters [in]: • S1. When by a call of function or a method the nonzero interface index is transferred through [in] parameter, call AddRef and Release, are not required, as time of life of a time variable in a stack is a strict subset of time of life of the expression used for initialization of formal argument. (Donald Boks, “ Essence of technology the COM ”) ---------------------- As a matter of fact, the argument of function obj - is argument such as in. Apparently from the citation, it is possible to apply various methods of a call of function with the entrance nonzero index of type [in.] AngelScript by such call does AddRef. And at us, unfortunately, is not present (accordingly, Release () we too we do not do{we make}). To correct at us all methods and functions accepting nonzero the index, will rather hardly, probably demand a spelling very much a plenty of wrappers. Perhaps it is possible what to correct that in the image at level AngelScript? Advise the decision of the given problem? Use of the signature of type &in in our case as it is not comprehensible because the copy of transmitted object is created, that frequently breaks logic of work of the program.

Share this post


Link to post
Share on other sites
I'm having a bit of difficulty understanding what you're writing. But I believe you're asking if there is some way to avoid using wrappers in order to take care of the AngelScript object handles passed in parameters to application functions that do not properly call Release() on them. Am I right?

The answer is yes. By using the AngelScript autohandles, @+, the script engine will automatically release any handles passed to application functions, once the function returns. This will alleviate the need for wrappers in most cases (at the cost of a slightly increased overhead in function calls).

Read the following page that I wrote about object handles for more information: Object handles on the AngelScript wiki

Regards,
Andreas

Share this post


Link to post
Share on other sites
Hello.

Thank it is valid, that is necessary. Thank big.

Quote:
Original post by WitchLord
I'm having a bit of difficulty understanding what you're writing. But I believe you're asking if there is some way to avoid using wrappers in order to take care of the AngelScript object handles passed in parameters to application functions that do not properly call Release() on them. Am I right?

The answer is yes. By using the AngelScript autohandles, @+, the script engine will automatically release any handles passed to application functions, once the function returns. This will alleviate the need for wrappers in most cases (at the cost of a slightly increased overhead in function calls).

Read the following page that I wrote about object handles for more information: Object handles on the AngelScript wiki

Regards,
Andreas


Share this post


Link to post
Share on other sites

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