Sign in to follow this  

How to alter an object handle value from host application?

Recommended Posts

I faced a problem when I wanted to change the content of a member variable in my script class.


This is my class:

class Foo
  int baz1;
  Bar@ baz2;

I can easily change value types in C++ by:

int* value = (int*)addressOfbaz1;
(*value) = 456;

But this doesn't work with object handles and I know why, but I don't know how I can alter the address that object handles are pointing to.

Edited by MahanGM

Share this post

Link to post
Share on other sites

Just don't forget to properly update the reference count of the objects referred to by the handle. Otherwise you'll get memory leaks (if you forget to call Release()), or dangling pointers (if you forget to call AddRef()).

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