View previous topic :: View next topic |
Author |
Message |
makari
Joined: 19 Jun 2008 Posts: 2 Location: Cincinnati, Ohio
|
Posted: Thu Jun 19, 2008 9:52 am Post subject: Proper way to begin multi-platform application |
|
|
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 |
|
|
makari
Joined: 19 Jun 2008 Posts: 2 Location: Cincinnati, Ohio
|
Posted: Thu Jun 19, 2008 10:15 am Post subject: |
|
|
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 |
|
|
clayasaurus
Joined: 21 May 2004 Posts: 857
|
Posted: Thu Jun 19, 2008 11:26 am Post subject: |
|
|
Usually there are frameworks which allows you to write one piece of code that runs on multiple platforms. |
|
Back to top |
|
|
csauls
Joined: 27 Mar 2004 Posts: 278
|
Posted: Sat Jun 21, 2008 12:17 am Post subject: |
|
|
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 |
|
|
|