FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Proper way to begin multi-platform application

 
Post new topic   Reply to topic     Forum Index -> General
View previous topic :: View next topic  
Author Message
makari



Joined: 19 Jun 2008
Posts: 2
Location: Cincinnati, Ohio

PostPosted: Thu Jun 19, 2008 9:52 am    Post subject: Proper way to begin multi-platform application Reply with quote

Ok, I'm trying to create an application with support for Windows and Linux platforms.

As I'm sure most people are familiar, the entry function is different for these two platforms. How can I define the entry function in another module and import it into the base module?

I know I can use a version construct in which I define the entry point for each version but I'd prefer to keep it modular if possible.

When performing something like:
Code:
module myApp;

version (nix)
{
    import include.linux.main;
}

version (win)
{
    import include.windows.main;
}

I get the following errors:
OPTLINK: Warning 23: No Stack
OPTLINK: Warning 134: No Start Address
Back to top
View user's profile Send private message
makari



Joined: 19 Jun 2008
Posts: 2
Location: Cincinnati, Ohio

PostPosted: Thu Jun 19, 2008 10:15 am    Post subject: Reply with quote

Nevermind, I'm an idiot! :P

I'm manually compiling and I forgot to hand the imported module to the compiler. The above code works as long as you remember to do that!

D'oh!
Back to top
View user's profile Send private message
clayasaurus



Joined: 21 May 2004
Posts: 857

PostPosted: Thu Jun 19, 2008 11:26 am    Post subject: Reply with quote

Usually there are frameworks which allows you to write one piece of code that runs on multiple platforms.
Back to top
View user's profile Send private message AIM Address
csauls



Joined: 27 Mar 2004
Posts: 278

PostPosted: Sat Jun 21, 2008 12:17 am    Post subject: Reply with quote

Assuming you're referring to using main() on *NIX and WinMain() on Windows, you actually can just use main() on both.

For Windows, you would use the Windows API (GetModuleHandle(null), if I remember right) to get your instance handle.
_________________
Chris Nicholson-Sauls
Back to top
View user's profile Send private message AIM Address Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> General All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group