#3 Add new type (userdatapointer)


In some situations when embedding Squirrel
"userdata" type is not very eficient: when I use
manually created objects or imported via API (ex.
ActiveX in windows). In this case using another
buffer with only one pointer inside is not very clean.

I suggest to use special type "userdatapointer".
This type is very close to "userdata" type but
instead of allocating data by VM this type has only
pointer with two functions - addref and release, all
specified in native language.

Inside engine this may be implemented as using

struct UserDataPointer {
void* data;
void (*addref)(HSQUIRRELVM, void*);
void (*release)(HSQUIRRELVM, void*);

This structure can be embeded into object structure
or pointer to it can be holded inside.

Next this allow future optimization of VM code to
make code very efficient.


  • Alberto Demichelis

    Logged In: YES

    I see your point but adding this into the object structure
    would double average the object size. I think is too heavy.
    You can have the same behaviour with a userdata and a

  • Alberto Demichelis

    • priority: 5 --> 1
    • assigned_to: nobody --> fagiano
    • status: open --> closed

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks