[Verse-dev] Using tags and C++ issues

Samuel Siltanen saasilta at cc.hut.fi
Mon Apr 25 14:12:05 CEST 2005


On Mon, 25 Apr 2005, Emil Brink wrote:

> Do you have to compile the Verse core code as C++, too? If you compile it
> separately as C and link to the library, isn't the number of such problems
> reduced?

Yes, it would be, but unfortunatelly it is not possible with the compiler 
I use. I get those same "undefined references" which TJay mentioned 
earlier. This problem has nothing to do with Verse, but the fact that 
the object files generated by gcc and g++ do not work together.

> I don't have a good solution for the callback function pointer types, at
> the moment. There is no way (that I know) to express "pointer to function
> that takes an unknown number of arguments" in C, without making it into
> a varargs function. Tips are very welcome.

I cannot imagine a way of doing it in C either. Of course it would be 
possible to do something like:

#ifdef __cplusplus
    // The code with C++ casting
#else
    // The C code version with (void *)
#endif

But this is very ugly.

> Absolutely. To be honest, I haven't built a C++ program using Verse my-
> self, but am aware of there being issues. Camilla, who works here at KTH,
> has done some work on a C++ wrapper (Ample), but I'm not sure what the
> status is there.

I am aware of that (it is in CVS), but I have not get it work yet.

> If you have patches for the Verse core to remove implicit casts (I try
> to use "~0u" rather than "-1" for the invalid/max IDs, it's cleaner I
> hope, I'm very interested. Please use diff -pun, and against the R5
> branch (release-r5-branch).
>
> If not, I should be able to cook up a 1-line C++ program that includes
> verse.h and see what can be fixed.

I am afraid that producing a patch is quite hard. The diff includes also 
the "void *"-function castings converted into C++-style castings and some 
other C++-stuff.

...

> Just as a ballpark figure, could you say how many tag values we're
> talking about here?

At first a tested with 10000-20000 values, but because that did not work, 
I used about 20 of them, but still I got only a fraction of them back.

Samuel


More information about the Verse-dev mailing list