NO

Author Topic: 64-bit SDL 2 and 64-bit Pelles C on Windows 10  (Read 2536 times)

agoodeno

  • Guest
64-bit SDL 2 and 64-bit Pelles C on Windows 10
« on: November 29, 2015, 03:54:25 pm »
Does anyone have 64-bit SDL 2 working with 64-bit Pelles C? I can't seem to compile/link an sdl2main.lib, which is needed to do some initialization before calling main(). I would be most grateful if someone could post the file here. Maybe you called it sdlmainlib, that's fine, as long is it's 64-bit.

Thanks

Alan

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 1902
Re: 64-bit SDL 2 and 64-bit Pelles C on Windows 10
« Reply #1 on: November 29, 2015, 05:07:56 pm »
SDL 2 don't need that  if use
Code: [Select]
#define SDL_MAIN_HANDLED
#include "SDL.h"
...
/* Initialize SDL */
#ifdef SDL_MAIN_HANDLED
SDL_SetMainReady(); // only when using SDL_MAIN_HANDLED
#endif
...
Code: [Select]
// SDL_MainW.c

int __cdecl main(int argc, char* argv[]);
#ifdef __POCC__
extern int __argc;
extern char **__argv;
#endif
int __stdcall WinMain(int hInstance, int hPrevInstance, char* lpszCmdLine, int nCmdShow)
{
return main(__argc, __argv);
}
« Last Edit: November 29, 2015, 05:46:04 pm by TimoVJL »
May the source be with you

agoodeno

  • Guest
Re: 64-bit SDL 2 and 64-bit Pelles C on Windows 10
« Reply #2 on: November 29, 2015, 09:42:39 pm »
TimoVJL,

I didn't know about SDL_MAIN_HANDLED! That worked. Thanks!  :)

A couple of things to remember, when using the command line for 64-bit stuff: polib needs the option -machine:x64, however, polink doesn't seem to need it. Also, cc and pocc need the option -Tx64-coff.

Alan