Re: function pointers in structures and Java
2003-12-02 00:39:45 GMT
Thanks for the info, it was very helpful.
In our case, the typemap didn't work, I suspect because the original
headers/C files are in K&R, it doesn't find Object *object in the parameter
list of the .c file.
However, I was able to make the following work, which is the same as our C
syntax usage, so that works just fine:
TYPEDEF(struct _TY, TY)
struct _TY {
#ifdef SWIG
PROTOTYPE(Boolean, foo, (TY *ty, int bar));
#else
PROTOTYPE(Boolean, (*foo), (TY *ty, int bar));
#endif
unsigned long buckets;
};
/* I'll end up making a PROTOTYPEF which will handle the SWIG differences
and simplify end user usage */
I didn't realize that that was the only issue I was up against...the (*foo)
as opposed to just the foo.
In this case, the usage in the .java file became:
_TY t1 = TY.new__TY(50);
_TY t2 = TY.new__TY(100);
(Continue reading)
RSS Feed