DieHard Wolfers Forum Index DieHard Wolfers
A Wolfenstein 3d Fan Community


  Hosted by: MCS & Areyep.com - Designed by: BrotherTank

Original Yahoo Forum - Die Hard Archives

AReyeP HomepageAreyep Homepage DieHard Wolfenstein BunkerDieHard Wolfenstein Bunker Log inLog in RegisterRegister Banlist FAQFAQ Search ForumsSearch

  Username:    Password:      Remember me       

SDL_main should not be used with SDL2
Page 1 of 1
DieHard Wolfers Forum Index -> SDL Code Crackers View Previous TopicRefresh this PageAdd Topic to your Browser FavoritesSearch ForumsPrint this TopicE-mail TopicGoto Page BottomView Next Topic
Post new topicReply to topic
Author Message
Matthew
DieHard Officer
DieHard Officer


Joined: 02 Jul 2007
Last Visit: 12 Aug 2019

Topics: 102
Posts: 506

usa.gif

PostPosted: Thu Aug 01, 2019 3:43 pm
   Subject: SDL_main should not be used with SDL2
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Bottom of Posts

I mentioned this in another thread, but I probably should post a separate thread about it.

SDL_main should not be used.

With SDL 1, it is used to inject initialization code, a terrible idea. With SDL 2, it is just used to abstract the entry point. All compilers look for "main" by default. There is no need to use "WinMain" on Windows. With MinGW, if there is no entry point, it gives an error message saying that "WinMain" is not defined, but defining "main" is enough.

Do not link to the "SDLmain" library, and have "#define SDL_MAIN_HANDLED" before including "SDL.h"

SDL_main causes an issue with mingw-w64: "libmingw32" is linked to by default, without any dependencies, but SDL_main creates a dependency with "libmingw32". If "libmingw32" is not explicitly linked to, or it is linked to after "SDL_main", the linker gives an error that "WinMain" is not defined when linking "libmingw32". See this discussion for details.

Why wasn't SDL_main just removed from SDL2?
Display posts from previous:   
Post new topicReply to topic Time synchronized with the forum server time
DieHard Wolfers Forum Index -> SDL Code Crackers View Previous TopicRefresh this PageAdd Topic to your Browser FavoritesSearch ForumsPrint this TopicE-mail TopicGoto Page TopView Next Topic
Page 1 of 1
Jump to:  

Related topics
 Topics   Replies   Views   Last Post 
No new posts Announcement: Wolf3d & Spear of Destiny Shareware SDL Downloads
Author: BrotherTank
10 18593 Tue Aug 24, 2010 10:18 am
dcbasic View latest post
No new posts Sticky: [Tutorial] Compiling Wolf4SDL with Code::Blocks
Author: dcbasic
90 35461 Wed May 24, 2017 7:53 pm
Falcon*93 View latest post
No new posts Remaking released mod into SDL
Author: Dean
14 5310 Thu Aug 14, 2008 4:58 pm
Dean View latest post
No new posts [Help] Gun Bobbing in SDL
Author: RichterBelmont12
8 3809 Wed Jul 23, 2008 6:37 pm
Tricob View latest post
No new posts [SDL] Apply 2nd ScaleFactor to selected (hi-res) vga gfx
Author: Andy_Nonymous
9 5781 Sun Apr 27, 2008 2:30 am
AlumiuN View latest post
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
   You cannot delete your posts in this forum
You cannot vote in polls in this forum


Copyright ©2003-2008 DieHard Wolfers
A Modified subBunker Theme by BrotherTank
Powered by phpBB © 2001, 2005 phpBB Group