Re: linux app to windows
- From: Hendrik Schober <Spamtrap@xxxxxx>
- Date: Thu, 20 Nov 2008 09:33:02 +0100
Victor Bazarov wrote:
Kyle wrote:I have been given the task of trying to migrate a linux app that one of the other admins wrote to windows. The source code is basically straight C with a few small issues, most of which are easily fixed. I have one question: Is there any way to have an if statement like this:
if compiling on linux
define strlwr(...,...)
end if
As you can see linux doesn't have a strlwr function so I need to define it, but windows has one. The goal is to allow the app to compile on both linux and windows so having the if wrapper would greatly help. All the app does is read in a file, flip somethings around, and write out a new file.
I think you're looking for a preprocessor directive for conditional compilation. Something like
#ifndef WIN32
#define strlwr(...,...)
#endif
Yes? No? Did I guess right? See the compiler documentation that would explain what preprocessor macros are pre-defined for you and look for something that would identify the target OS. I don't know what a Linux compiler would have defined if the target OS is Linux. But it would probably have "linux" in the name...
GCC?
V
Schobi
.
- Follow-Ups:
- Re: linux app to windows
- From: Cholo Lennon
- Re: linux app to windows
- References:
- linux app to windows
- From: Kyle
- Re: linux app to windows
- From: Victor Bazarov
- linux app to windows
- Prev by Date: Re: Logger
- Next by Date: Re: Base64 string save to binary file
- Previous by thread: Re: linux app to windows
- Next by thread: Re: linux app to windows
- Index(es):
Relevant Pages
|