Google Grupper har inte längre stöd för nya Usenet-inlägg eller -prenumerationer. Historiskt innehåll förblir synligt.
Stäng

Detect platform at compile-time

4 visningar
Hoppa till det första olästa meddelandet

Mikael

oläst,
12 okt. 2003 07:37:072003-10-12
till
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]

oläst,
12 okt. 2003 13:04:132003-10-12
till
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]

oläst,
12 okt. 2003 13:08:422003-10-12
till
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 nya meddelanden