On Tuesday 11,August,2009 03:51 AM, Cédric Tabin wrote:
Hello Chow,
Thanks for your feedback :-) I've fixed the issues you mentionned (I hope) and upgraded a little bit my code. Since now I always used my small compile script which is very simple :
#!/bin/sh
source="src/Plugin.c" output="XMLPrettyPrinter"
gcc -std=c99 -o "$output.o" -Wall -c -fpic "$source" `pkg-config --cflags geany libxml-2.0` gcc -shared -o "$output.so" "$output.o" `pkg-config --libs geany libxml-2.0`
And so far there was no compile error. Can you explain me how to use the automatic build so I won't commit unbuildable code ? One more question : in my Plugin.c file, I #include the PrettyPrinter.c file because at if I use PrettyPrinter.h, at runtime Geany said me that it was unable to find the reference to my PrettyPrinter options... Maybe something wrong in my compilation script ? That's a problem of linking isn't it ?
There is something wrong with your compilation script. Generally all .c files are compiled and linked together, where all .c files are mapped into .o files respectively. Your script omits the PrettyPrinter.c file, and hence cannot find references if PrettyPrinter.c is not #included, because only the function prototypes are in PrettyPrinter.h (definitions are in PrettyPrinter.c)
As for the issue with the for loop, the reason for that happening is because gcc defaults to -std=gnu89, which is based on the C90 standard, whereas declarations within the for loop only work with -std=c99 and above. I think it's best to stick to this standard (C90) for portability reasons.
Anyway, there are actually two build systems in place. One uses Autotools, and the other uses Waf. To use the Autotools build system, you run autogen.sh once in trunk/geany-plugins to generate the configure script and Makefiles, then cd into your plugin directory and run "make" to compile. This can be repeated in an edit-make-edit-make kind of cycle, and I think you'll find this better than your script because it only recompiles the parts which have changed. To install, run "make install" as root. To test the installation with an alternate root directory, you may use "make DESTDIR=/path/to/alternate/root install".
To use the Waf build system, see the README.waf document in trunk/geany-plugins.