[Sorry Michael for double reply!]We still used glib-1.2.10, because it has way less dependencies... I also compile the stuff
Hi Michael,
Michael Tuexen wrote:
> The sctplib is written in C and this should not be changed. That means that the file extension should
> be .c, it should be compilable by a C compiler and it should not use any C++ extensions or functions.
Ok, np, I just wanted to make sure. ;-)
> What you can do is to encapsulate a List and Array structure in new types, implement
> them via GLib (most preferable via C macros). Then you can also provide an additional
> implementation of these structures via C++ stuff.
Ok, please see below.
> What I do not understand: Why can't you just use the glib?
Well, glib works, but glib is very big by itself (GArray and GList being only a tiny fraction), implies even more dependencies (iconv...), and is not exactly trivially to compile under Windows (default CRT DLL issues, support for new (2005 and 2008) compilers, etc.). Maybe this is also because I prefer to compile code whenever possible with my own SCons <http://www.scons.org> scripts, because I usually need everything under Windows and Linux, each with multiple compilers and each in turn with multiple configurations (debug with and without symbols, profile, release), having maximum warning levels and treat-warnings-as-errors enabled all the time.
Well, overall it is just a personal preference, and some experience that cleaner and leaner libraries work better on all platforms with fewer problems.
> Is the way above (use C macros and provide definitions using the glib and C++ stuff) is doable?
Yes, I think so. In fact, I've just started doing this. However, I'm not sure how exactly your suggestion with the macros works. Right now, I'm using an approach that works without altering the sctplib code at all (except for other Win32 related issues):
I just create new headers glib.h, garray.h and glist.h in a subdirectory named "glib-repl". In this subdirectory I also place replacement implementations garray.c and glist.c.
glib.h contains the required typedefs and macros, reduced to a minimum (i.e. whatever sctplib needs).
I think the replacement stuff is very nice... I think we can manage that from a configure
Then, all that is required for compiling is to make the compiler consider "glib-repl" among the set of its header include directories, rather than the full glib installation directory. This way, you can have an arbitrary number of glib "replacements" side-by- side, and you can switch between them without touching the code.
Best regards,
Carsten
--
Ca3D - Engine http://www.Ca3D-Engine.de
Carsten Fuchs http://www.Ca3D-Engine.de/c_Carsten.php
Archive powered by MHonArc 2.6.19+.