Re: [Vala] undefined reference to 'SDL_Init' and/or 'WinMain@16' (under Windows)
Sorry I am just now getting to this, but here is my work to get SDL + Opengl in vala working on windows: https://github.com/gorilla3d/Hi-Panda/blob/master/Makefile It was a painful process. You don't need a main or winmain functions at all. I ended up side loading cygwin, and visual studio libraries (for opengl). Hopefully that helps enough. I also packaged the libraries I ended up using with vala-0.12 http://files.myopera.com/sutabi/vala_game_sdk/vala-0.12.0.zip that may also help. On Tue, Mar 20, 2012 at 6:27 AM, wrote: > Really strange... > > This code below is correct and a window appears ! > == > using GLib; > using SDL; > > int WinMain(string[] argc) > { > SDL.Surface *screen; > > if( SDL.init( InitFlag.VIDEO ) < 0 ) > { > stdout.printf( "Impossible d'initialiser SDL: %s\n", > SDL.get_error( ) ); > return 1; > } > > > screen = SDL.Screen.set_video_mode( 640, 480, 16, > SurfaceFlag.HWSURFACE ); > SDL.WindowManager.set_caption ("Vala SDL Demo", ""); > > if( screen == null ) > { > stdout.printf( "Impossible d'initialiser le mode video: %s\n", > SDL.get_error( ) ); > return 1; > } > > SDL.Timer.delay( 3000 ); > SDL.quit(); > return 0; > } > > > int main(string[] argc ) > { > stdout.printf ("not printed\n"); > > return 0; > } > = > > The "main" function is not called and I've got two warnings : > Compilation time : > test2.vala:5.1-5.11: warning: method `WinMain' never used > int WinMain(string[] argc) > > Linking time : > Warning: resolving _WinMain@16 by linking to _WinMain > > I need to have these two function "main" and "winmain"... :-? > > Ehm... > > Thanks > > >> Hi >> WinMain usually is the entry point for Win32 programs (isntead of >> main()). If you do not have such a function defined in your C-Code you >> get the >> the error message you described. At least that's the experience I have >> with that error message with pure C an WinAPI >> >> regards >> andi >> >> >> >> Am 20.03.2012 12:06, schrieb r...@no-log.org: >>> Ehm.. I don't have any idea or any clue >>> >>> I've tried to create C code and compile it : >>> - >>> /* test2.c generated by valac 0.12.0, the Vala compiler >>> * generated from test2.vala, do not modify */ >>> #include >>> #include >>> #include >>> #include >>> #include >>> #include >>> >>> gint _vala_main (gchar** argc, int argc_length1); >>> >>> gint _vala_main (gchar** argc, int argc_length1) { >>> gint result = 0; >>> SDL_Init ((guint32) 0); >>> SDL_Quit (); >>> fprintf (stdout, "Hello world!"); >>> result = 0; >>> return result; >>> } >>> >>> int main (int argc, char ** argv) { >>> g_type_init (); >>> return _vala_main (argv, argc); >>> } >>> - >>> >>> And I've got the same error (which is not surprising...) : >>> gcc -o C:/vala\test2 C:/vala/test2.vala.c -mms-bitfields >>> -Ic:/vala/include/glib-2.0 -Ic:/vala/lib/glib-2.0/include -Lc:/vala/lib >>> -lgobject-2.0 -lgthread-2.0 -lglib-2.0 -lintl -lSDL -lSDLmain -lmingw32 >>> -mwindows >>> c:/vala/lib/libmingw32.a(main.o):main.c:(.text+0xbd): undefined >>> reference >>> to `WinMain@16' >>> collect2: ld returned 1 exit status >>> >>> Hello, 2012/3/20: > Perhaps a basic linkage error but I dont know how to correct :D You should be looking at the SDL FAQ for Windows: http://wiki.libsdl.org/moin.cgi/FAQWindows For example this question seems to be exactly what you want (don't forget -X before each argument): I get "Undefined reference to 'WinMain@16'" Under Visual C++, you need to link with SDLmain.lib. Under the gcc build environments including Dev-C++, you need to link with the output of "sdl-config --libs", which is usually: -lmingw32 -lSDLmain -lSDL -mwindows >>> ___ >>> vala-list mailing list >>> vala-list@gnome.org >>> http://mail.gnome.org/mailman/listinfo/vala-list >> >> > > ___ > vala-list mailing list > vala-list@gnome.org > http://mail.gnome.org/mailman/listinfo/vala-list -- Joseph Montanez Web Developer Gorilla3D Design, Develop, Deploy ___ vala-list mailing list vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
[Vala] CCode finish_function
Hi, dealing with asynchronous construction I stumbled across CCode statements (e.g. in the gio-2.0 bindings) like: [CCode (finish_function = "g_async_initable_new_finish")] Unfortunately, I could not find any documentation for it neither in [1] nor elsewhere. Any hint on how to use this? Is this a way to set explicitly the finish_function for the callback from init_async methods (and similar) ? thanks [1] https://live.gnome.org/Vala/Manual/Attributes#CCode_Attribute -- tomw ___ vala-list mailing list vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] [ANNOUNCE] Vala 0.16.0 - Compiler for the GObject type system
Wrong link ;) Monday, March 26, 2012, 7:47:19 PM, you wrote: > We are pleased to announce version 0.16.0 of Vala, a compiler for the > GObject type system. > Vala 0.16.0 is now available for download at: >http://download.gnome.org/sources/vala/0.15/ > Changes since 0.15.2 > * Add udisks2 bindings. > * Bug fixes and binding updates. ___ vala-list mailing list vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
[Vala] [ANNOUNCE] Vala 0.16.0 - Compiler for the GObject type system
We are pleased to announce version 0.16.0 of Vala, a compiler for the GObject type system. Vala 0.16.0 is now available for download at: http://download.gnome.org/sources/vala/0.15/ Changes since 0.15.2 * Add udisks2 bindings. * Bug fixes and binding updates. Vala is a programming language that aims to bring modern programming language features to GNOME developers without imposing any additional runtime requirements and without using a different ABI compared to applications and libraries written in C. valac, the Vala compiler, is a self-hosting compiler that translates Vala source code into C source and header files. It uses the GObject type system to create classes and interfaces declared in the Vala source code. More information about Vala is available at http://www.vala-project.org/ The Vala Team ___ vala-list mailing list vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] How to deal with "target" attribute in VAPI for C struct?
Ugh, sorry, obviously that code: > public delegate void ComputingFinishedCallback(); should be: public delegate void ComputingFinishedCallback(void* sender); m. ___ vala-list mailing list vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
[Vala] How to deal with "target" attribute in VAPI for C struct?
Hi, I have a part of C code that I need to include in my Vala project. It contains code +/- like that: typedef void (*computing_finished_cb) (void *self); typedef struct computer { computing_finished_cb on_finished; void* parent; } computer; size_t computer_compute(computer *c); I've created VAPI file like that namespace MyLib { [CCode (cname="computer", cheader_filename="computer.h")] public struct Computer { ComputingFinishedCallback on_finished; void* parent; [CCode (cname="computer_compute")] public compute(); } [CCode (cname="computing_finished_cb", has_target=false)] public delegate void ComputingFinishedCallback(); } Now I can use it like that: public class Example { public MyLib.Computer computer; public Example() { computer = MyLib.Computer(); computer.parent = this; // code in compute() knows that it has to pass this pointer to the callback when computing is finished computer.on_finished = on_finished; } public void compute() { computer.compute(); } static void on_finished(void* sender) { MyLib.Computer computer = sender as MyLib.Computer; computer.do_something_else(); } public void do_something_else() { //... } } It works but it breaks encapsulation as if I want to access anything from on_finished() I have to mark it public. Could you give me any advise how to modify that to achieve Vala-style code? Like that...? public class Example { public MyLib.Computer computer; public Example() { computer = MyLib.Computer(this); computer.on_finished = on_finished; } public void compute() { computer.compute(); } private void on_finished() { do_something_else(); } private void do_something_else() { //... } } The problem that I've encountered is that when I remove "has_target=false" from VAPI, vala tries to initialize *_target and *_target_destroy_notify functions per each callback member of the struct, do a lot of ref & unrefs etc... Is there any clean way to do that? Preferably without changing struct to full-flavored GObject? Thank you in advance, m. ___ vala-list mailing list vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
[Vala] remote control library in Vala?
Hi, Is there an open source remote control library out there with Vala bindings? -- Duff ___ vala-list mailing list vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list