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,  <r...@no-log.org> 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<glib.h>
>>> #include<glib-object.h>
>>> #include<stdlib.h>
>>> #include<string.h>
>>> #include<SDL.h>
>>> #include<stdio.h>
>>>
>>> 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<r...@no-log.org>:
>>>>> 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

Reply via email to