Evaluating pointer values

BlitzMax Forums/BlitzMax Programming/Evaluating pointer values

gameshastra(Posted 2008) [#1]
Hi,
I have a function pointer whose value in memory is shown by the debugger as $005483AA if I use Int (Byte Ptr (Varptr _function))) I get an integer value which doesn't match with the address converted from hexadecimal. I would appreciate your help on this.

Thanks


Who was John Galt?(Posted 2008) [#2]
What's the integer value you get? The debugger is definitely showing the value stored in the function pointer, and not where the function pointer itself is in memory?


Dreamora(Posted 2008) [#3]
you don't need byte ptr( varptr _function)
just use byte Ptr( _function )
Functions are no objects, so varptr isn't needed

as well what you get might be a relative adress to the 0 point of the BM memory space. not needfully global memory position


gameshastra(Posted 2008) [#4]
Thanks that put me onto a good path.
How do I get a pointer to object given Self (Self is similar to this in c++).

Regards


Dreamora(Posted 2008) [#5]
Self is not similar to this in C++, it is no reference. As Super is no reference.

What you need to do is assign self to an object of that class. Do not use ptr thoughts on BM objects for whatever reason. It will not raise the reference count and the pointer can / will become invalid when the object is not referenced.
As well you can not use BM objects outside of BM, that will near sure cause access violations as the GC does not care for that. If you want to share objects with C++ then use C++ objects that you declare as extern types and use them within BM. They are not GC handled and need to be generated/destroyed by C++