Re: Euraylib Released!

new topic     » goto parent     » topic index » view thread      » older message » newer message

David, you are correct. This is similar to the issue I explained here: https://openeuphoria.org/forum/134018.wc#134018

Basically, when we see a structure being passed by value, we have to expand its values as separate parameters. Since Vector2 is two floats, and floats are 32-bit values, it expands to {C_FLOAT,C_FLOAT}. This should work fine for passing structures by value, and is pretty straight-forward when the values are all 32-bit or greater. But as I pointed out in that thread, sometimes the structure members have to be packed into a larger value, which complicates things a bit (e.g. four unsigned chars becomes one unsigned int).

The bad news is that, at least until someone can go fix it in the backend, you cannot receive structures by value from an external function. I know Allegro does this. Not sure if Raylib is the same. This should be as simple as changing the return_type in define_c_func from atom to object and then we just pull more values off the stack after the function returns and return a matching result (e.g. C_UINT returns an atom, {C_UINT,C_UINT} returns {atom,atom}).

-Greg

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu