Re: Detecting WIN32 or .NET example in a compiler directive
- From: Rob Kennedy <me3@xxxxxxxxxxx>
- Date: Wed, 18 Oct 2006 12:02:12 -0500
Skybuck Flying wrote:
program ProjectDetectDotNet;
{$APPTYPE CONSOLE}
uses
SysUtils;
begin
{$IF DEFINED(WIN32)}
WriteLn('Welcome to the WIN32 world !');
Readln;
{$ELSEIF DEFINED(CLR)}
Console.WriteLine('Welcome to the .NET world !');
Console.ReadLine;
{$ELSE}
*** unknown world ;) ***
{$IFEND}
end.
*** End of Code ***
As you can see the code is exactly the same (except for the program directive which does nothing ;))
Indeed. There's no reason to have two.
In your particular example, there's no reason for the compiler directives at all. Writeln and Readln work fine in .Net. They're defined as part of the Delphi language.
However it seems it is necessary to create two different projects, one for win32 and one for .net.
Yeah. So?
If you want to switch, close the project and re-open the DPR file. The IDE will ask which environment you want to use.
Maybe it's possible to create one project and simply use a compiler directive to switch between compile environments ???
The problem is that it's really two different compilers. Compiler directives are processed by the compiler, obviously, but once you've invoked a compiler, it's too late to choose which one you want in a compiler directive.
--
Rob
.
- Follow-Ups:
- Re: Detecting WIN32 or .NET example in a compiler directive
- From: Skybuck Flying
- Re: Detecting WIN32 or .NET example in a compiler directive
- References:
- Detecting WIN32 or .NET example in a compiler directive
- From: Skybuck Flying
- Detecting WIN32 or .NET example in a compiler directive
- Prev by Date: This post is utter and complete spam. Anyone want a job?
- Next by Date: Re: Where is stringbuilder?
- Previous by thread: Detecting WIN32 or .NET example in a compiler directive
- Next by thread: Re: Detecting WIN32 or .NET example in a compiler directive
- Index(es):
Relevant Pages
|