I'm having a small issue. When I send my UTF-8 string to a function it puts stuff in it no problem but as soon as the function closes and goes back the string is empty. It's being passed by pointer so nothing is being returned.
It sounds more like you are passing an regular object on the stack, but you said you're using a pointer. Show the code for the function that isn't working.
I commonly do this mistake.
In this case, the variable "tip" is only local to this function. Meaning that this line:
tip=al_ustr_new("");
does not change the value of "tip" which you've passed when you called this function:
ShowToolTip(Inventory[0],tip);
You should change the function to something like this:
Calling the function:
ShowToolTip(Inventory[0], &tip);
Ahh hey that does make sense. Thanks Fish
This is simpler:
ALLEGRO_USTR *ShowToolTip(Item item) { ALLEGRO_USTR *tip=al_ustr_new(""); // ... return tip; } ALLEGRO_USTR *tip = ShowToolTip(item); // maybe it should be called GetToolTip()
Also, you are passing the item by value. You may want to pass its pointer (or by reference if using C++).