Re: Passing floats/doubles to C

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

On Sun, 13 Feb 2000 11:07:16 -0600, Todd Riggins <triggins at AIRMAIL.NET>
wrote:
>That looks interesting. But I need to pass the Euphoria made structure
>to a "C"-coded structure in my dll. I need those values to be put into
>a DIRECT3D structure that contains floats. So basically, I need
>to convert( pass ) things to "C", not from.
>Thanks for trying to help though...
>
>-- Todd Riggins

Todd: All you have to do is declare the DIRECT3D structure

-- a 3d structure  with 3 parameter or how many you need the HIGH
-- means to allocate it in high memory
 constant DIRECT3D  = struct(" 3ddata_1 : doulble : 1 "&
                             " 3ddata_2 : doulble : 1 "&
                             " 3ddata_3 : doulble : 1 ",HIGH)
-- put values in structure
  Sets(DIRECT3D, "3ddata_1", 2375.888)
  Sets(DIRECT3D, "3ddata_2", 2285.8)
  Sets(DIRECT3D, "3ddata_3", 2.888)

-- Then call your "C" routine and pass DIRECT3D constant which is
-- the pointer to the structure. If you need to know the size of
-- the declared structure just do use sizeof(DIRECT3D) function
-- If "C" returns a pointer to some other structure then declare that
-- structure giving it's exact discription, take the returned pointer
-- and do this
 mem_copy(declared_structure, returned_pointer, sizeof(declared_structure))
-- then you can use the names in the declared_structure to access the
-- structure

Bernie

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

Search



Quick Links

User menu

Not signed in.

Misc Menu