invalid pointer to class registered

Started by
4 comments, last by WitchLord 18 years, 1 month ago
i encountered errors with registered classes in angelscript 2.5c. C3D p3D; r = engine->RegisterGlobalProperty ("sr3D STARX", &p3D); assert(r >= 0); STARX.printf ("abc"); i get a null pointer exception during execution. is it because i registered too many classes?
Advertisement
That is highly unlikely.

It looks like you are registering a variable declared on the stack. Thus when the scope is gone, the variable disappears.

i thought it is the scope issue initially.

but now C3D p3D is declared as a global variable to all classes.
You'll have to show us more, for us to be able to determine what the problem is.

How is the type sr3D registered?

How is the printf() method registered?

How is the string type registered?

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


i am using another 3D library to provide all the rendering functions, but this library exposes these functions to AngelScript too, via a method call.

what happened is i need to expose my own version of the functions, so i just register the relevant classes i needed to AngelScript.

so if i run my sample without the 3D library exposed to AngelScript, i can get the sr3D pointer and everything is working fine.

just by exposing the 3D library, my sr3D pointer will be invalid. i have debug and found that it points to another address.

how can i check whatever is registered ? i want to trace them and see when the values are altered.


Sounds strange to me that the object address would be different just because you expose the 3D library or not. Are you checking all the return codes from AngelScript?

What 3D library are you using? Perhaps there is some known problem with it.

In my design I assumed that the application would know what was registered with the library, therefore there is no existing way of enumerating what is already registered. I'll have to rethink this in a future version and expose methods to do that.

In the meantime you could probably debug the library itself and check what is registered by setting breakpoints in the Register methods.

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

This topic is closed to new replies.

Advertisement