Sign in to follow this  

AngelScript 2.6.0 WIP 4

Recommended Posts

I've uploaded the third WIP to the site. I've modified the implementation of the methods to get and set arguments to the script functions, i.e on the asIScriptContext and asIScriptGeneric. This was done to be more consistent when working with parameter references and objects. If you're using these methods, it is possible they start to fail if you update to this version. If that happens you should try switching to one of the other methods, for example SetArgAddress() instead of SetArgObject(), and vice versa. Generally speaking you should use the method that best matches how the parameter was registered, i.e. SetArgAddress() for parameter references, and SetArgObject() for objects and object handles. I've also spent a lot of time on making the library compatible with 64bit CPUs. There is still no support for native calling conventions on 64bit CPUs, but you should be able to use the library anyway by declaring the flag AS_64BIT_PTR when compiling the library. What this does is to change how pointers are stored in the compiled bytecode. There is likely some things that still don't work on 64bit processors so I need your help to test the library. Hopefully there should only be a few things though. Regards, Andreas [edit]2006-03-30: Uploaded WIP 4[/edit] [Edited by - WitchLord on March 30, 2006 8:02:50 PM]

Share this post

Link to post
Share on other sites
I've got a problem in that I can no longer register a function like this:

r=ASWrapper->ScriptEngine->RegisterGlobalFunction("float Modf(float x, float &inout)" ,asFUNCTIONPR(modf,(float, float*),float) , asCALL_CDECL); assert(r >=0 );

This is using 2.6.0 WIP3.

It used to work for 2.5.0c.

Share this post

Link to post
Share on other sites
Indeed, you cannot.

What you can do however, is to compile the library with AS_ALLOW_UNSAFE_REFERENCES, and then register the function with:

r=ASWrapper->ScriptEngine->RegisterGlobalFunction("float Modf(float x, float&)" ,asFUNCTIONPR(modf,(float, float*),float) , asCALL_CDECL); assert(r >=0 );

Only object types that support object handles allow the use of &inout now (except when unsafe references are allowed). I had to do this in order to keep the script language consistent and avoid confusion for the script writers.


Share this post

Link to post
Share on other sites
I've just uploaded WIP 4 of version 2.6.0. Now the first script
classes are complete. You can declare classes in the scripts with
methods, properties, and constructors to initialize them. The
application can create the classes and call the members as well as
access the properties.

This version is feature complete, so if you intend to upgrade to 2.6.0
you might as well give yourself a headstart and help me test it in the

The next step is to implement interfaces for polymorphism, and single
inheritance for reusing implementations. I decided to a similar
solution to OO that Java uses, as the C++ is way too complicated and
doesn't work well with the way the script functions. The interfaces
should serve well for any polymorphism needs, and the single
inheritance should be sufficient for most cases where inheritance is


Share this post

Link to post
Share on other sites
Hello Andreas,
I've got a problem.
I would like to call class method with argument from C/C++ code.

int methodId = engine->GetMethodIDByDecl(0, "myclass", "void method2( float a )");
if( methodId < 0 )
fail = true;
asIScriptContext *ctx = engine->CreateContext();
ctx->SetArgFloat( 0, 1.0f );
int r = ctx->Execute();
fail = true;
if( !v || *v != 3 ) fail = true;


I had error during ctx->Release() execution:
"HEAP CORRUPTION DETECTED after Normal block...."

How to call method with argument ?


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