1. Problem calling DLL C function [Solved]

Hi everybody,

I am tring to call this function from euphoria:

CSFML_API void sfRenderWindow_Clear(sfRenderWindow *RenderWindow, sfColor Color) 

where sfColor is:

typedef struct 
{ 
     sfUint8 r; 
     sfUint8 g; 
     sfUint8 b; 
     sfUint8 a; 
} sfColor; 

this is what i did, without success:

atom clear_window = define_c_proc(csfml_window, "sfRenderWindow_Clear", {C_POINTER, C_UCHAR, C_UCHAR, C_UCHAR, C_UCHAR}) 

the C_POINTER is ok (i just receive him from other wrapped c_func), but the window don't get clean by the correct color

this is how i call:

c_proc(clear_window, {app,255,255,255,255}) --it should clear to white 

is define the color struct by 4 consective U_CHAR correct???

ps.: sorry my bad english ;)

new topic     » topic index » view message » categorize

2. Re: Problem calling DLL C function [Solved]

I just solved it.

atom clear_window = define_c_proc(csfml_window, "sfRenderWindow_Clear", {C_POINTER, C_UINT}) 
 
c_proc(clear_window, {app, 0xffffffff}) --clear to white OK!!! 

I just realized that even declaring 4 consecutive C_UCHAR they are passed as 4 consecutive C_UINT under the hood, so only the first value (4 bytes) was received by the C function, cleaning my window to red instead of white.

Euphoria is awesome!

ps.: sorry my bad english ;)

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu