Hello,
I want to write a .NET DLL (using c#) which is to be used in both
the .NET Compact Framework on Windows CE, and in the standard
framework on servers and desktop applications.
Which is the way to do that? Simply referencing a "normal" dll project
from a "smart device" application project does not work.
Thanks,
markus
|
|
0
|
|
|
|
Reply
|
MarkusSchaber
|
12/23/2009 4:35:41 PM |
|
You (often) can use the same source code. However, each must be compiled to
target the appropriate framework, Desktop or Compact.
You cannot do what you want. In general, the underlying microprocessor uses
a different machine language, and while the IL (Intermediate Language) that
Visual Studio compiles to may be interchangeable, the IL itself is compiled
into machine code before it is executed. This step is not intended to be
done at runtime, though JIT compilation may be used.
Also, the Compact Framework (as its name implies) is a subset of the full
framework on the Desktop. So, it is quite possible to use Desktop framework
types that are not included in the Compact Framework. And, there is no rule
that says that the IL for the Desktop and Compact Frameworks will be,
exactly, identical. I suspect, without actual knowledge to state this with
certainty, that there can be minor differences due to optimizations made for
each platform. The compilation process, naturally, validates the used of
the appropriate framework types vs. the target framework.
Dick
--
Richard Grier, Consultant, Hard & Software 12962 West Louisiana Avenue
Lakewood, CO 80228 303-986-2179 (voice) Homepage: www.hardandsoftware.net
Author of Visual Basic Programmer's Guide to Serial Communications, 4th
Edition ISBN 1-890422-28-2 (391 pages) published July 2004, Revised July
2006.
|
|
0
|
|
|
|
Reply
|
DickGrier
|
12/23/2009 5:26:08 PM
|
|
Hi, Rick,
On Dec 23, 6:26=A0pm, "DickGrier" <dick_grierNOS...@msn.com> wrote:
> You (often) can use the same source code. =A0However, each must be compil=
ed to
> target the appropriate framework, Desktop or Compact.
Ah, I see, so I have to create two projects using the same source
files, and keep them in sync manually?
> You cannot do what you want. =A0In general, the underlying microprocessor=
uses
> a different machine language, and while the IL (Intermediate Language) th=
at
> Visual Studio compiles to may be interchangeable, the IL itself is compil=
ed
> into machine code before it is executed. =A0This step is not intended to =
be
> done at runtime, though JIT compilation may be used.
AFAIK, the dlls always contain IL regardless of the framework
implementation, and regardless whether it is interpreted, JIT-
compiled, or AOT-compiled during installation.
> Also, the Compact Framework (as its name implies) is a subset of the full
> framework on the Desktop. =A0So, it is quite possible to use Desktop fram=
ework
> types that are not included in the Compact Framework. =A0And, there is no=
rule
> that says that the IL for the Desktop and Compact Frameworks will be,
> exactly, identical. =A0I suspect, without actual knowledge to state this =
with
> certainty, that there can be minor differences due to optimizations made =
for
> each platform. =A0The compilation process, naturally, validates the used =
of
> the appropriate framework types vs. the target framework.
I know that the CF is limited. But most of my code is "self-
contained" (mostly data type definitions and some business logic), and
the rest uses only some basic funtionality which is available in the
compact framework (I browsed the docs to ensure that).
If it is true what you say, it is not easily possible to create
applications which are distributed over compact and non-compact
framework implementations, as you cannot share their data types..
This is much different to what I know from Java, where the smaller
editions really are subsets (plus some specific extensions API), and
only some pre-verification steps are to be added (which don't hurt
running that code on the desktop environment at all).
Thanks for your help,
Markus Schaber
|
|
0
|
|
|
|
Reply
|
MarkusSchaber
|
12/24/2009 7:42:02 AM
|
|
"MarkusSchaber" <msr@soloplan.de> wrote in message
news:968f2c4d-f575-4cc9-81de-39f85a07a268@h9g2000yqa.googlegroups.com...
Hi, Rick,
On Dec 23, 6:26 pm, "DickGrier" <dick_grierNOS...@msn.com> wrote:
> You (often) can use the same source code. However, each must be compiled
> to
> target the appropriate framework, Desktop or Compact.
Ah, I see, so I have to create two projects using the same source
files, and keep them in sync manually?
Thanks for your help,
Markus Schaber
Markus,
When you create the first project, put the source file in question there.
In the second project, click the down arrow on the Open Existing item button
and link to the source file. Now you only have one source file.
Mike.
|
|
0
|
|
|
|
Reply
|
Michael
|
12/24/2009 3:40:14 PM
|
|
What Michael said. Also make sure that the libraries (various types) that
are referenced in the two frameworks have the same functionality.
Dick
--
Richard Grier, Consultant, Hard & Software 12962 West Louisiana Avenue
Lakewood, CO 80228 303-986-2179 (voice) Homepage: www.hardandsoftware.net
Author of Visual Basic Programmer's Guide to Serial Communications, 4th
Edition ISBN 1-890422-28-2 (391 pages) published July 2004, Revised July
2006.
|
|
0
|
|
|
|
Reply
|
DickGrier
|
12/24/2009 6:20:20 PM
|
|
|
4 Replies
108 Views
(page loaded in 0.155 seconds)
|