Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Detect platform at compile-time

4 views
Skip to first unread message

Mikael

unread,
Oct 12, 2003, 7:37:07 AM10/12/03
to
Is it possible to detect the targeted platform at
compilation time?

I have some code that should be executed on the device
only (ARMV4) not in the emulator (x86).

I've been looking for a conditional compilation statement
("#if...") to use, but have not found one.

Regards,
Mikael

Peter Foot [MVP]

unread,
Oct 12, 2003, 1:04:13 PM10/12/03
to
Not directly because the code generated by a Smart Device project is in
intermediate code and therefore platform agnostic. However you can set up
within your project multiple configurations - with different destinations
for the compiled exe (or dll) - A project will have Debug and Release
configurations by default you could add a "Desktop" configuration to this.
Build > Configuration Manager then select New from the Drop Down list

You can then define a constant for this configuration - e.g. DESKTOP
Project > ProjectName Properties > Configuration Properties > Conditional
Compilation Constants - add to the list (separate with semi colon)

You can then use conditional compilation to perform different actions for
the desktop and device configurations e.g.
#if DESKTOP
//call desktop specific function
#else
//call device function
#endif

Peter

--
Peter Foot
Windows Embedded MVP
OpenNETCF.org Senior Advisor
www.inthehand.com | www.opennetcf.org

"Mikael" <n...@spam.com> wrote in message
news:058301c390b5$2aa6a330$a301...@phx.gbl...

Peter Foot [MVP]

unread,
Oct 12, 2003, 1:08:42 PM10/12/03
to
Note also when setting the project properties for the DESKTOP
configuration - to change the output folder for the build - by default
bin/Release but this will overwrite your device dll when you compile so
change to a new output folder such as bin/Desktop. Note to build the two
versions of the project you will need to build one, switch configurations
and rebuild the other when you make changes to the code.

Peter

--
Peter Foot
Windows Embedded MVP
OpenNETCF.org Senior Advisor
www.inthehand.com | www.opennetcf.org

"Peter Foot [MVP]" <feed...@nospam-inthehand.com> wrote in message
news:O%23VveLO...@tk2msftngp13.phx.gbl...

0 new messages