PC Review


Reply
Thread Tools Rate Thread

Conditional Compilation Question

 
 
=?Utf-8?B?Um9iZXJ0IFcu?=
Guest
Posts: n/a
 
      21st Sep 2005
I have a solution that consists of a WinForms app and a Pocket PC app. Each
of these two projects shares a 3rd project that is a compiled library file
(DLL).

The items in the library are pretty much common to both apps but there are a
few differences. For example, there's no "Beep" function for Pocket PCs.
So, to get around these few exceptions I put some conditional compilation
statements in where required Thus, for example, Beep took on this form:

#if (POCKETPC)
Debug.Writeline("");

#else
[DllImport("kernel32.dll")]
public static extern bool Beep (int freq, int duration);
#endif

Where "POCKETPC" is a tag I define at the very start of my Pocket PC app's
main form.

Everything *appears* to compile properly but I'm wondering two things:

1. Is this a correct & safe way to do things?

2. Are the resultant DLLs that go onto the two respective computers actually
compiled differently?

--
Robert W.
Vancouver, BC
www.mwtech.com

 
Reply With Quote
 
 
 
 
Scott Roberts
Guest
Posts: n/a
 
      21st Sep 2005

"Robert W." <(E-Mail Removed)> wrote in message
news8E365B6-8D88-4AE1-AB18-(E-Mail Removed)...

> I have a solution that consists of a WinForms app and a Pocket PC app.

Each
> of these two projects shares a 3rd project that is a compiled library file
> (DLL).
>
> The items in the library are pretty much common to both apps but there are

a
> few differences.


> 1. Is this a correct & safe way to do things?



Is it not possible to factor differences out into their respective apps and
make the library be exactly the same for both apps? That would be *my*
preference.

In your example, instead of optionally declaring "Beep()" I would create a
"UserNotify" singleton class in each app that knows how to "notify" the user
for that particular type of application. The 3rd DLL would simply call the
"Notify()" (or "Beep()" if you prefer) method of the singleton - which would
work regardless of the type of application running.


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
C# Conditional Compilation - VS Configuration - Newbie Question Paul Microsoft C# .NET 1 24th Oct 2006 06:52 PM
Conditional compilation question Dave Microsoft C# .NET 10 8th Jun 2006 08:45 PM
Conditional Compilation ME Microsoft Dot NET 3 20th May 2005 09:34 AM
Hard question - How to change conditional compilation constants through code? Andrew Webster Microsoft Access VBA Modules 2 3rd Mar 2004 10:00 PM
Conditional Compilation/Conditional Constants chris han Microsoft C# .NET 1 10th Jul 2003 09:50 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:31 AM.