Re: how to write a wrapper?

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

Jules wrote:
> 
> Andy wrote:
> > 
> > You should only be fine with a reference to c. Just go over some
> > documentation
> > of C and you should be fine
> 
> oh dear, I've been (politely) RTFM'ed. 
> 
> probably better if I post something specific. I'll get as far as I can and
> when
> stuck I'll return. 
> 
> Thanks anyway.

You need three things actually:

1/ A fair idea of what the dll/so you wrap has inside. You'll get this knowledge
from the documentation of the shared file, which may or may not be suitably
organised. In some cases, feedback from users, if available, may help.

2/ A fair idea of what the ysers of your wrapper would like to do with it, and
which sort of pivture of what the hared lib handles they have. The most
important, because you are the one who is going to translate the shared lib's
ressources into stuff users may have interest in and can grok.

No C so far.

3/ The knowledge, from the documentation of the shared file, of the prototypes
of the routines/vars you are going to use from the lib. You have to know what is
a char, signed or not, a wchar, a tchar, an int and perhaps all sorts of fancy
things. Pointers are well handled by the C_POINTER data type in the define_c_*()
definition sequence, so the issue isn't as big as one would think. That's the
only place some basic knowledge of C is needed.

Unless you need to understand the source of the lib, if available. That's
another matter.

Also, remember that things are straightforward for shared libs coded in C, but
not quite if they were output by a C++ compiler. I think the doc of fptr.e by M.
Lewis contains useful information; I never tried it myself. Looking at the
wxEuphoria wrappers is probably even more educational.

CChris

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

Search



Quick Links

User menu

Not signed in.

Misc Menu