On Di, 2010-06-29 at 22:15 +0100, Harry Van Haaren wrote: > Andrea wrote: > > > if your intent is to bind ad use the add function your binding it's > > quite right, but can be simpler: > > > > [CCode (cheader_filename="bindMe.h")] > > namespace Math > > { > > [CCode (cname="add")] > > public static int add (int a, int b); > > } > > > Thanks, that's what I needed to hear ;-) > > I'm working on a LibSndFile wrapper, that's the reason for learning > wrapping. > I've got the a small part working, but not much (yet). I'm compiling with > valac --save-temps, > and analysing the output to work out where my errors are. > > I'm getting stuck on "enum" types, that are *NOT* in a namespace. > Eg: the name of the enum IS what to call that in the output C file. > > enum > { /* True and false */ > SF_FALSE = 0, > SF_TRUE = 1, > /* Modes for opening files. */ > SFM_READ = 0x10, > SFM_WRITE = 0x20, > SFM_RDWR = 0x30, > SF_AMBISONIC_NONE = 0x40, > SF_AMBISONIC_B_FORMAT = 0x41 > } ; > > Is the one I'm stuck on now. I tried this in the .vapi: > class Sndfile > { // all other functions ommitted for brevity > [CCode (cname="")] > public enum FileMode > { /* True and false */ > SF_FALSE = 0, > SF_TRUE = 1, > /* Modes for opening files. */ > SFM_READ = 0x10, > SFM_WRITE = 0x20, > SFM_RDWR = 0x30, > SF_AMBISONIC_NONE = 0x40, > SF_AMBISONIC_B_FORMAT = 0x41 > } > } > > but the C output goes like so SNDFILE_FILE_MODE_SFM_READ while I want > SFM_READ. > I hoped that the cname="" would clear the SNDFILE_FILE_MODE_ from the > start but it didnt.. > > Any pointers as to how to do this? Cheers, -Harry Use cprefix="" - maybe you also need to set cname="int" in order to have Vala know what to call the type of the values.
-- Julian Andres Klode - Debian Developer, Ubuntu Member See http://wiki.debian.org/JulianAndresKlode and http://jak-linux.org/. _______________________________________________ vala-list mailing list vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list