RE: Help with wrappers

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

------- Original message ---------

Subject: Help with wrappers




Hi all,
 I would like to code a wrapper for the open source Irrlicht game engine so
that I can use the engine's functions with euphoria. Can anyone give me info
on how I would go about doing it? 

If I am understanding it correctly, I would need some type of .dll from the
engine itself in order for it to work, then I would need to use c_proc and
c_func to convert individual routines inside c header files?

Any help at all is appreciated.

Thanks

I would make a good member of a large crowd :)


--------- End of original message -------------------

There are actually 3 steps to go through.
 
1/ Your wrapper must open a shared file (.dll on Windows, .so on Linux/BSD) 
using open_dll() (be sure to include machine.e). This function will return
some atom I'll call entry_point.

2/ For each routine you need to wrap, define a constant representing that
routine using defie_c_func (or _proc):

constant
the_func=define_c_func(entry_point,func_name,arg_type_list,return_type)

You can also access public  variables using define_c_var().

3/ Then, in any program using the routines, including your own wrapper, 
you use c_func() or c_proc() to call the routine, using the identifiers 
defined in stage 2 as routine ids.

And that should be all, unless you have to fiddle with calling convention.
If the doc for your dll talks about cdecl, then there is a specific syntax
to use in define_c_func.

More details in the docs for define_c_func,c_func and open_dll.

HTH
CChris

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

Search



Quick Links

User menu

Not signed in.

Misc Menu