RE: for Liu Junfeng How to deal with C_POINTR?

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

>> when define and call c_func often there are parameters passed by
>> pointers, then how to send and get data if it is a c struct?

Liu Junfeng:
  You can do this with my mixedlib.e which you can get here:
   http://www.rapideuphoria.com/mixedlib.zip

--=============== Code Starts Here =================
include mixedlib.e

-- First describe any structure that you want to use
-- to access with the pointer being returned.
record("RECT",
  "Left:long:1 "&
  "Top:long:1 "&
  "Right:long:1 "&
  "Bottom:long:1 ")

-- Next associate the returned_pointer to the structure
AssociatePtr( returned_pointer, "RECT" )

-- Now to get the "Top" value from the structure
atom aValue
aValue = grab( returned_pointer, "Left" )

-- to set a value
put( returned_pointer, "Bottom", 27 )

--=============== Code Ends Here =================
Remember, you can define any structure you want
and when you describe the structure all the
offsets are automatically calculated so you
don't have to calculate anything just describe the structure.

Bernie

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

Search



Quick Links

User menu

Not signed in.

Misc Menu