conditional-compilation

CPP extension and multiline literals in Haskell

Is it possible to use CPP extension on Haskell code which contains multiline string literals? Are there other conditional compilation techniques for Haskell? For example, let's take this code: -- If the next line is uncommented, the program does not compile. -- {-# LANGUAGE CPP #-} msg = "Hello\ \ Wor\ \ld!" main = putStrLn msg ...

Conditional compilation hackery in C# - is there a way to pull this off?

I have an internal API that I would like others to reference in their projects as a compiled DLL. When it's a standalone project that's referenced, I use conditional compilation (#if statements) to switch behavior of a key web service class depending on compilation symbols. The problem is, once an assembly is generated, it appears that i...

Is there an easy way in C# to have conditional compilation symbols based on OS version

I have a bunch of unit tests that need to be conditional compiled based on Windows OS version. This unit tests are testing TxF that is only available in Windows Vista and above. #if WIN_OS_VERSION >= 6.0 // Run unit tests #endif ...

linux/unix and makefiles

In linux make file: I want to run the output program only in case of successful compilation. Is there a way to do this? ...

C#: VS.NET: Change name of exe depending on conditional compilation symbol

Can you tell Visual Studio to output a different name of an exe file depending on if a specific conditional compilation symbol is set? ...

Javascript: change based on whether IE7 or not

I would like to change a line of my javascript code based on whether the browser is IE7 or not. Here is the code for any other browser: function showHint(myId) { document.getElementById(myId).style.display = "inline-block"; } For IE7, I want display = "inline". I've made an attempt at conditional compilation (this showed me how ...

XCode : linking different libraries depending on architecture (cpu type)

I'm developing an iPhone app which needed voip support so i added the ARM version of pjsip libraries. But if I'm using the iPhone simulator i want to link the i386 version of the libraries. How can i do that? ...

Generating arguments for the mxmlc Flex Ant task

My ActionScript project builds with several compile-time specified constants. They are all Booleans, and only one of them is true at any given time. The rest must be false. When I represented my build process in a bash script, I could loop through the names of all these constants, set one of them to be true and the rest to be false, the...

Tools to generate unit dependencies for Delphi

Are there any tools that can generate dependency diagrams for Delphi units taking into account conditional compilation directives. I'd like to emphasize that this should be unit dependency diagram, not class dependency. Also it would be nice to have the ability to rearrange and hide some parts in the generated diagram. I've tried Unders...

GWT - Browser based Conditional Compilation

Hi all, is there a way to tell GWT to compile different Java code per target browser? GWT today creates a different script per target browser, all generated from the same source file. However, when working with non-standard features in different browsers (for example, file drag and drop into the browser), the support is quite different ...

Which conditional compile to use to switch between Mac and iPhone specific code?

I am working on a project that includes a Mac application and an iPad application that share code. How can I use conditional compile switches to exclude Mac-specific code from the iPhone project and vice-versa? I've noticed that TARGET_OS_IPHONE and TARGET_OS_MAC are both 1, and so they are both always true. Is there another switch I ...

Conditionally compiling UI components & logic

Hello there, I'm looking at producing a few versions of my app with restricted functionality, and I'd like to leave out the code that is not necessary in simpler versions. Being a WinForms app, the UI will have to change for each version - not displaying the restricted controls. I made an attempt to annotate parts of the auto generate...

Delphi {$IFDEF CONSOLE} Problem

I just tried program Project1; {$APPTYPE CONSOLE} uses SysUtils; begin {$IFDEF CONSOLE} beep; {$ENDIF} end. and expected to hear a beep during runtime, but not. The following test works, though: if IsConsole then beep; Why doesn't the compile-time test work? As far as I can understand from this doc, it sure shoul...

Conditional compilation with Java and ant

I have a problem wit the software I'm working on. We are accessing Windows system calls via JNA, and we have to define some Windows structure (Java class that extends the JNA Structure) to be able to access them. The application has to work with 32-bit and 64-bit architecture, but the problem with the structures is that attributes in t...

c#: Conditional DEBUG - Does it still compile into RELEASE code?

I know that if I mark code as DEBUG code it won't run in RELEASE mode, but does it still get compiled into an assembly? I just wanna make sure my assembly isn't bloated by extra methods. [Conditional(DEBUG)] private void DoSomeLocalDebugging() { //debugging } ...

Conditional compiling in OCaml

Hello, suppose I have a long algorithm which I would like to be optionally verbose to debug it. So far I just added many if verbose then printf "whatever" all around the code but this forces the code to execute many useless tests if I don't want to have it in the verbose mode. Is there a way to obtain a simple conditional compilation wh...

How to avoid "unused variable" compiler warnings with conditionally compiled NSLog replacements?

This comes out of my search for a smart variant of NSLog(). One key feature of BetterLog() is that the NSLog() replacement compiles out to nothing for release and distribution builds. The proposed solution (see eg http://stackoverflow.com/questions/300673/is-it-true-that-one-should-not-use-nslog-on-production-code) is define a preprocess...

Detecting C++0x mode on Intel C++?

Does Intel C++ predefine some macro when compiling with Qstd=c++0x? Something like __GXX_EXPERIMENTAL_CXX0X__ in GCC? __cplusplus is still 199711. Any way to detect C++0x compilation? ...

Alternatives to Conditional Compilation in C#

What is the alternative to having code with conditional compilation in C#? I have a class that has lots of code that is based on # ifdef .. After sometime my code is unreadable. Looking for refactoring techniques to use for better readability and maintenance of code with many #if defs ...

Visual Studio C# projects: how to place conditional references in .csproj?

Hello, I'm working on an open source project (Logbus-ng), and I need to implement a web service spawned by a console application in a way that works both on Windows and Mono. Currently, thanks to the tutorial by MSDN Magazine, I succeeded in doing this on Windows. A console application can spawn its own web server and actually open a we...