Re: How can I pass an atom to a C function as C float or double

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

On 12 Sep 2003 at 23:27, myotis at xnet.ro wrote:

> Please tell me how can I pass an atom as a C float to a C
> function from a dll. The same question is for a C double ...
> 
> Example of the C function in DLL :
> 
> float MyFunction( float parameter1, double parameter2 );
> 
> I have tried all the posible combinations ( C_FLOAT in define the C 
> function, atom_to_float32 when I pass the arguments ... nothing work )
> 
> Please write to me a little piece of euphoria code that call this 
> function in Euphoria. Also tell me the calling convention you are write 
> for ...
> I can change this in my DLL as I want.
> 
> Also, please tell me if the version of euphoria you are
> writeing for the example, matter for some reason.
> 
> Thank you !

Can you try this:

integer junk
junk = allocate(5)
poke(junk, atom_to_float32(x))
poke4(junk+1, atom_to_float64(y))

then pass your params the pointer to "junk"

f = Myfunction(peek(junk),peek4(junk+1))

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

Search



Quick Links

User menu

Not signed in.

Misc Menu