RE: DLL Automatic Wrapper Generator

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

It does already handle passing strings, and does the work for them, even 
for the retVal of a c_func, but not objects yet.
This version is still a rough prototype. I will probably allow for more 
flexibility.

Any sequence used as an arg variable or retVal will be treated as such 
in the wrapper.

if you define:
{"Function",{C_INT,{},C_INT,etc},{}}

the wrapper would look like this: (I haven't tested this yet)
global function Function(integer arg1, sequence arg2, integer arg3, etc)
 atom ret
 atom tmp2
   allocate_string(arg2)
   ret = c_func(xFunction,{arg1,tmp2,arg3,etc})
   free(tmp2)
   return peek_string(ret)
end function

If all the args are sequences, it would allocate for all of them.

It shouldn't be hard to fix it to work for pointers or atoms.


Chris


Andy Serpa wrote:
> 
> >    Let me know what you think. I would like to get some test results 
> > before I give it to the archives.
> > 
> 
> Looks good.  One thing I would like to see is the ability to define a 
> string argument in c function, and be able to pass to the generated 
> wrapper function a Euphoria sequence/string.  The function would 
> automatically allocate_string(), call the c_func, then free() it.  And 
> if I pass an atom to the function instead, then it will assume it is a 
> pointer and skip that step...
> 
>

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

Search



Quick Links

User menu

Not signed in.

Misc Menu