Re: sharing pointer kinds between libraries
Nicolas Cannasse <ncannasse <at> motion-twin.com>
2006-04-26 15:47:30 GMT
> hey nicholas,
>
> i'm having progress with my OpenGL wrapper, i'll publish soon.
>
> one question tho- opengl uses plain double* and int* a lot. i have no problem in doing a simple neko library
to allocate/read/write those, so they are createable and accessible from neko (and thus haxe). what i
really want to do tho, is to share the kinds i define for those between libraries (GL and GLU for example, but
also others).
>
> now, the ad-hoc way to do this of course is to make a new shared library (say, "cptr"), that exists both as a
.ndll providing the access/alloc functions, and as a .so to link the other libs (GL.ndll) against. then i
can DECLARE_KIND my kinds in cptr.h, and DEFINE_KIND them in libcptr.so, against which both cptr.ndll
and GL.ndll will link to have access to the kind.
>
> tho i am thinking that these types are so fundamental and appear in libs again and again that it would be nice
to be able to use them without the additional burden of another shared lib. so- what do you think about
defining them as constant integers instead of using the memory address of a symbol? or is this too ugly
design-wise? if not, should they probably be defined in neko.h? or at least be part of the standard dist?
That's a good question.
I actualy already thought the same about the "hashtable" and "int32"
types. Should they be declared in libneko ? in the standard library ?
where should the exported api go ?
I made the following choices :
- int32 is declared in libneko, and has only very minor support
(printing). It's mainly used in Std but is "standardized" so the same
"kind" can be used in different libraries. Actually, the only reason
(Continue reading)