The problem is this:
When we run a C# application that uses this assembly directly on a 32-bit PC
using VS 2005, it works perfectly. When we try to do the same using any of
the ARMV4i device emulators (Windows Mobile 5 or 6), the assembly's code
completely goes crazy and starts to throw all sorts of random exceptions
(NullReference, etc.) that aren't valid in the VS2005 debugger. So,
something tells me that we've built the assembly incorrectly somehow.
However, our impression was that using the AnyCPU flag would allow the
assembly to be portable to any OS, including the ARMV4i devices.
The assembly was compiled using Delphi 2007's .NET compiler. It uses
pre-compilation files (.dcpil) that are generated from the CF assemblies for
linking purposes, and these were built using the CF 2.0 assemblies here:
C:\Program Files\Microsoft.NET\SDK\CompactFramework\v2.0\WindowsCE
Initially, we thought that the problem may be due to these assemblies not
working on ARMV4i devices, so we generated new .dcpil files using the
extracted ARMV4i assemblies from the CF 2.0 .cab file here:
C:\Program
Files\Microsoft.NET\SDK\CompactFramework\v2.0\WindowsCE\wce500\armv4i\NETCFv2.wm.armv4i.cab
But, that made no difference at all.
Ultimately, my question is this:
Can you take an assembly compiled with the AnyCPU flag and run it on an
ARMV4i device and have it work without any changes ? Or are there issues or
restrictions with the ARMV4i processor that need to be taken into account by
the .NET compiler (and that aren't) ? Our assembly (compiled for CF) passes
PEVerify with no problems at all.
--
Tim Young
Elevate Software
www.elevatesoft.com
Could you clarify, is this a Delphi for .NET app or a C# app compiled
with the CodeGear IDE?
--
Marc Rohloff [TeamB]
marc -at- marc rohloff -dot- com
<< Could you clarify, is this a Delphi for .NET app or a C# app compiled
with the CodeGear IDE? >>
Sorry for not being more specific.
This is a Delphi.NET assembly/package (it's actually a .NET data provider)
compiled with the Delphi 2007 (RAD Studio) .NET command-line compiler
dccil.exe being used from within a VS C# application for testing purposes.
It is only for use from non-CodeGear IDEs, so the Borland.Delphi.System.pas
unit is linked into the package.
This all works fine when the assembly is used on any Windows machine with
the normal desktop .Net framework, and works fine when used with the CF
framework on a normal desktop, but when used on a CF device (Windows Mobile
ARMV4I processor) with the CF framework, it fails miserably with random
runtime exceptions. This leads me to believe that the issue is not
specifically a CF issue with the Delphi.NET compiler, but rather something
more complicated than that. I was hoping to find out if anyone else has
used the Delphi.NET compiler with more than a "hello world" app on a Windows
Mobile device with CF.
> This is a Delphi.NET assembly/package (it's actually a .NET data provider)
> compiled with the Delphi 2007 (RAD Studio) .NET command-line compiler
> dccil.exe being used from within a VS C# application for testing purposes.
> It is only for use from non-CodeGear IDEs, so the Borland.Delphi.System.pas
> unit is linked into the package.
So I assume you recompiled the Delphi runtimes against the CF
assemblies?
> This all works fine when the assembly is used on any Windows machine with
> the normal desktop .Net framework, and works fine when used with the CF
> framework on a normal desktop, but when used on a CF device (Windows Mobile
> ARMV4I processor) with the CF framework, it fails miserably with random
> runtime exceptions.
What sort of exceptions do you get? My first suspect would be P/Invoke
calls to non-existent functions.
Have you tried running it on the device emulator?
> Marc,
>
> more complicated than that. I was hoping to find out if anyone else has
> used the Delphi.NET compiler with more than a "hello world" app on a
> Windows
> Mobile device with CF.
>
Yes, although I don't know how much help I can be.
I managed to compile an application for CF.NET using Delphi 2006 last
year, and it ran fine, more or less.
However, it was basically a self contained application (not a DLL, didn't
really call any other .NET assemblies
beyond the framework itself) and also didn't use VCL.NET, of course - so
if your issues stem from problems with
assemblies then I guess I wouldn't have encountered those.
Debugging it was also a pain, as you'd expect. But it did work - obviously
had to compile the app against the CF
libraries and select 'link in Delphi units' on the Borland libraries.
Not tried with D2007, although you'd hope things still worked at least as
well as under D2006...
Cheers,
David Capps
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
<< So I assume you recompiled the Delphi runtimes against the CF assemblies?
>>
Absolutely. Here's the batch file I'm using:
@echo off
set cpu=%1
dccil --clrversion=v2.0.50727 -DCF -m -q -nsBorland.VclCF -nsBorland.Vcl -ln"c:\delphi11\lib\cf\%cpu%"
-W-UNIT_PLATFORM -W-SYMBOL_PLATFORM -lu"c:\delphi11\lib\cf\%cpu%\assemblies\mscorlib.dll"
-lu"c:\delphi11\lib\cf\%cpu%\assemblies\System.dll" -lu"c:\delphi11\lib\cf\%cpu%\assemblies\System.Xml.dll"
-lu"c:\delphi11\lib\cf\%cpu%\assemblies\System.Drawing.dll" -lu"c:\delphi11\lib\cf\%cpu%\assemblies\System.Windows.Forms.dll"
-lu"c:\delphi11\lib\cf\%cpu%\assemblies\System.Data.dll" -lu"c:\delphi11\lib\cf\%cpu%\assemblies\System.Windows.Forms.DataGrid.dll"
-lu"c:\delphi11\lib\cf\%cpu%\assemblies\System.Web.Services.dll" -lu"c:\delphi11\lib\cf\%cpu%\assemblies\System.Net.IrDA.dll"
-N"c:\delphi11\lib\cf\%cpu%" -U"c:\delphi11\lib\cf\%cpu%" -LN"c:\delphi11\lib\cf\%cpu%"
-z --no-config -Y -
"c:\delphi11\source\dotnet\rtl\borland.delphi.system.pas"
The cpu parameter was for trying to compile against both the CF assemblies
that are installed in the desktop (C:\Program
Files\Microsoft.NET\SDK\CompactFramework\v2.0\WindowsCE), and those from the
ARMV4I .cab file (C:\Program
Files\Microsoft.NET\SDK\CompactFramework\v2.0\WindowsCE\wce500\armv4i\NETCFv2.wm.armv4i).
I just copied them into subdirectories under the \delphi11\lib\cf directory,
one called arm and one called x86. I was trying to determine if the issue
was that I was generating .dcpil files using the wrong CF assemblies for the
target CPU. But, it didn't make any difference - the result was the same.
<< What sort of exceptions do you get? My first suspect would be P/Invoke
calls to non-existent functions. >>
I saw the MissingMethodException exceptions initially for some of the
P/Invoke calls that we had for unbuffered file I/O, but those are all fixed
once I tracked down the couple that weren't supported).
Now I'm getting NullReferenceException exceptions on code like this:
procedure TEDBExprValidater.CheckTokenType(Token: TEDBExprToken;
Expected: TEDBTokenTypeSet);
begin
if (not (Token.TokenType in Expected)) then
ExpectedTokenTypes(Token,Expected);
end;
where TEDBTokenTypeSet is declared as:
TEDBTokenTypeSet = set of TEDBTokenType;
It blows up with a NullReferenceException when it tries to perform the "in"
operation. The calling code looks like this:
CheckTokenType(Token,[Expected]);
where expected is parameter of the type:
Expected: TEDBTokenType
I'm thinking that there's something about the in operator's IL code that
isn't working correctly with the ARM processors.
<< Have you tried running it on the device emulator? >>
That's when it blows up (Windows Mobile 6 Professional Emulator). It works
fine when run against the CF assemblies on the desktop. It's just as fast,
and works as perfectly, as the normal .Net framework assembly.
BTW, I've also got a support incident going with MS and their Mobile Device
group, so I'll post what I find out back here when I finish with them.
<< I managed to compile an application for CF.NET using Delphi 2006 last
year, and it ran fine, more or less. However, it was basically a self
contained application (not a DLL, didn't really call any other .NET
assemblies beyond the framework itself) and also didn't use VCL.NET, of
course - so if your issues stem from problems with assemblies then I guess I
wouldn't have encountered those. >>
Our assembly basically fits the same mold - it only calls the .NET
assemblies, except for a few P/Invoke calls, which work fine.
<< Debugging it was also a pain, as you'd expect. >>
Actually, I can debug our Delphi assembly in VS2005 and VS2008 *while it is
running in the emulator*. As long as you generate a .PDB to go along with
the assembly, VS will step through/into the Object Pascal source code and
allow you to set breakpoints, etc. It's actually pretty cool.
<< But it did work - obviously had to compile the app against the CF
libraries and select 'link in Delphi units' on the Borland libraries. >>
Yep, same here. We're creating a package/assembly, but we're only linking
in the Borland.Delphi.System.pas unit. The rest is all dynamic references
to .NET assemblies only.
<< Not tried with D2007, although you'd hope things still worked at least as
well as under D2006... >>
Those were my thoughts also. <g>
Thanks very much for your help,
> It blows up with a NullReferenceException when it tries to perform the "in"
> operation. The calling code looks like this:
> CheckTokenType(Token,[Expected]);
So I assume that Token, TokenType and Expected are all non-null? What
does the IL look like?
<< So I assume that Token, TokenType and Expected are all non-null? >>
Yep, at least in my source code they are. The same exact code runs fine on
the desktop.
<< What does the IL look like? >>
Here's the CheckTokenType IL:
.method assembly instance void CheckTokenType(class edbexpr.TEDBExprToken
Token,
valuetype edbexpr.TEDBTokenTypeSet Expected) cil managed
{
// Code size 33 (0x21)
.maxstack 3
.locals init ([0] valuetype edbexpr.TEDBTokenType V_0)
IL_0000: ldarg.1
IL_0001: call instance valuetype edbexpr.TEDBTokenType
edbexpr.TEDBExprToken::get_TokenType()
IL_0006: stloc.0
IL_0007: ldloc.0
IL_0008: ldc.i4.s 64
IL_000a: blt.un.s IL_0010
IL_000c: ldc.i4.0
IL_000d: conv.u8
IL_000e: br.s IL_0016
IL_0010: ldarg.2
IL_0011: ldc.i4.1
IL_0012: conv.u8
IL_0013: ldloc.0
IL_0014: shl
IL_0015: and
IL_0016: brtrue.s IL_0020
IL_0018: ldarg.0
IL_0019: ldarg.1
IL_001a: ldarg.2
IL_001b: call instance void
edbexpr.TEDBExprValidater::ExpectedTokenTypes(class edbexpr.TEDBExprToken,
valuetype edbexpr.TEDBTokenTypeSet)
IL_0020: ret
} // end of method TEDBExprValidater::CheckTokenType
And here's the code that calls it (partial):
IL_007d: br.s IL_0093
IL_007f: ldarg.0
IL_0080: ldarg.1
IL_0081: ldc.i4.1
IL_0082: conv.u8
IL_0083: ldarg.2
IL_0084: shl
IL_0085: ldc.i4.8
IL_0086: ldc.i4.0
IL_0087: ldc.i4.8
IL_0088: ldc.i4.0
IL_0089: call uint64
Borland.Delphi.Units.System::@SetExpandUInt64(uint64,
int32,
int32,
int32,
int32)
IL_008e: call instance void
edbexpr.TEDBExprValidater::CheckTokenType(class edbexpr.TEDBExprToken,
valuetype edbexpr.TEDBTokenTypeSet)
The one glaring item is the call into the SetExpand function in the
Borland.Delphi.System unit.
Also, I just got off the phone with MS, and they did indeed confirm that
there are a handful of normal framework IL opcodes that will not work with
CF, so it is possible that this is what I'm seeing here. Although, it
certainly doesn't explain why it works with CF on the desktop.
> << So I assume that Token, TokenType and Expected are all non-null?
> Yep, at least in my source code they are. The same exact code runs
> fine on the desktop.
I'm guessing that one of them is null in reality. It would narrow
things down a bit.
> The one glaring item is the call into the SetExpand function in the
> Borland.Delphi.System unit.
It is rather, it would be interesting to see the IL for
@SetExpandUInt64.
> Also, I just got off the phone with MS, and they did indeed confirm
> that there are a handful of normal framework IL opcodes that will
> not work with CF, so it is possible that this is what I'm seeing
> here. Although, it certainly doesn't explain why it works with CF
> on the desktop.
Here is a list:
http://blogs.msdn.com/bluecollar/archive/2006/09/27/773065.aspx
I didn't seen any though.
<< I'm guessing that one of them is null in reality. It would narrow things
down a bit. >>
Well, it certainly is possible, but it isn't happening because of my code.
For example, if I comment out the CheckTokenType call so that the code is
allowed to continue to run, I get a NullReferenceException in another area
of the code that is, again, an area where there is no way there is a NULL
reference. If I take the *exact same assembly* and just run it on the
desktop using the *exact same C# exe*, it runs fine. In fact, I can trace
the whole thing in the Delphi.Net debugger and everything is perfect.
<< It is rather, it would be interesting to see the IL for @SetExpandUInt64.
>>
Here it is. The actual code is just a bunch of shifts and ands to extract
bit settings:
.method public static uint64 @SetExpandUInt64(uint64 Src,
int32 dHi,
int32 dLo,
int32 sHi,
int32 sLo) cil managed
{
// Code size 67 (0x43)
.maxstack 4
.locals init ([0] uint64 Result)
IL_0000: ldarg.0
IL_0001: stloc.0
IL_0002: ldarg.3
IL_0003: ldarg.s sLo
IL_0005: sub
IL_0006: ldc.i4.8
IL_0007: bge.s IL_0016
IL_0009: ldloc.0
IL_000a: ldc.i4.m1
IL_000b: conv.i8
IL_000c: ldarg.3
IL_000d: ldarg.s sLo
IL_000f: sub
IL_0010: ldc.i4.3
IL_0011: shl
IL_0012: shl
IL_0013: not
IL_0014: and
IL_0015: stloc.0
IL_0016: ldarg.s sLo
IL_0018: ldarg.2
IL_0019: blt.s IL_0026
IL_001b: ldloc.0
IL_001c: ldarg.s sLo
IL_001e: ldarg.2
IL_001f: sub
IL_0020: ldc.i4.3
IL_0021: shl
IL_0022: shl
IL_0023: stloc.0
IL_0024: br.s IL_002f
IL_0026: ldloc.0
IL_0027: ldarg.2
IL_0028: ldarg.s sLo
IL_002a: sub
IL_002b: ldc.i4.3
IL_002c: shl
IL_002d: shr.un
IL_002e: stloc.0
IL_002f: ldarg.1
IL_0030: ldarg.2
IL_0031: sub
IL_0032: ldc.i4.8
IL_0033: bge.s IL_0041
IL_0035: ldloc.0
IL_0036: ldc.i4.m1
IL_0037: conv.i8
IL_0038: ldarg.1
IL_0039: ldarg.2
IL_003a: sub
IL_003b: ldc.i4.3
IL_003c: shl
IL_003d: shl
IL_003e: not
IL_003f: and
IL_0040: stloc.0
IL_0041: ldloc.0
IL_0042: ret
} // end of method System::@SetExpandUInt64
<< Here is a list:
http://blogs.msdn.com/bluecollar/archive/2006/09/27/773065.aspx
I didn't seen any though. >>
Yeah, found that also. <g> As far as I can see, the Delphi.Net compiler
doesn't use any of those opcodes, but I didn't perform an exhaustive
analysis either.
Does anyone know any of the .NET compiler guys at CodeGear ? Perhaps they
can be coaxed to give up some information in exchange for some beer. <g>
i've managed to compile a 2.0 CF project with the DCCIL.exe shipped with
Delphi 2006.
i've not tried to compile with the one shipped with Delphi 2007.
it would be interesting for many to know if it works.
Lionel
before launching CfProjCompileV2.Bat, you have to build your CF platform by
launching Compil1.bat, Compil2.bat, Compil3.bat, see below ( you need
Borland.Delphi.System.pas )
CfProjCompileV2.Bat : Compile a CF V2 project ( DPR and Winform.pas are at
the end of this mail)
@echo off
del C:\Delphi2006\Travail\CF\CF2\CompilV2\TestV2\*.dcuil
del C:\Delphi2006\Travail\CF\CF2\CompilV2\TestV2\*.dcpil
Call "C:\Program
Files\Borland\BDS\4.0\bin\Dccil.exe" --clrversion:v2.0.50727
"C:\Delphi2006\Travail\CF\CF2\CompilV2\TestV2\Project1.Dpr" -U"C:\Delphi2006\Travail\CF\CF2\CompilV2"
-LU"C:\CF2\System.dll;C:\CF2\System.Xml.dll;C:\CF2\System.Windows.Forms.dll;C:\CF2\System.Data.dll;C:\CF2\System.Drawing.dll" -DCF -X"C:\Delphi2006\Travail\CF\CF2\CompilV2\TestV2\ProjCFV2.Exe"pauseexplanation of directories :(1) directory C:\Delphi2006\Travail\CF\CF2\CompilV2\TestV2 : contains theproject to compile (Project1.Dpr)Directory of C:\Delphi2006\Travail\CF\CF2\CompilV2\testV227/06/2008 10:53 <REP> .27/06/2008 10:53 <REP> ..02/11/2007 17:51 510 CfProjCompileV2.Bat02/11/2007 11:06 10 789 Project1.bdsproj02/11/2007 11:06 742 Project1.bdsproj.local02/11/2007 11:06 677 Project1.cfg02/11/2007 11:06 3 970 Project1.dpr02/11/2007 10:58 4 396 Project1.res02/11/2007 11:06 164 Project1.rsp02/11/2007 16:37 5 236 WinForm.dcuil02/11/2007 16:37 2 691 WinForm.pas02/11/2007 16:04 6 538 WinForm.resx02/11/2007 16:07 3 248 WinForm.TWinForm.resources(2) directory C:\CF2 : contains the V2 dll's that you have to extract fromthe PDA, they are in the \windows directory ( their name start with GAC...,copy them to your PC and rename them )Directory of C:\CF227/06/2008 10:34 <REP> .27/06/2008 10:34 <REP> ..09/05/2006 14:59 14 296 CustomMarshalers.dll09/05/2006 14:59 351 200 Microsoft.VisualBasic.dll09/05/2006 14:59 31 208 Microsoft.WindowsCE.Forms.dll09/05/2006 14:59 183 288 Microsoft.WindowsMobile.DirectX.dll09/05/2006 14:59 909 768 mscorlib.dll09/05/2006 14:59 693 712 System.Data.dll09/05/2006 14:59 463 296 System.dll09/05/2006 14:59 58 320 System.Drawing.dll09/05/2006 14:59 75 224 System.Messaging.dll09/05/2006 14:59 17 368 System.Net.IrDA.dll09/05/2006 14:59 62 944 System.Web.Services.dll09/05/2006 14:59 49 648 System.Windows.Forms.DataGrid.dll09/05/2006 14:59 240 608 System.Windows.Forms.dll09/05/2006 14:59 1 027 528 System.Xml.dll(3) directory C:\Delphi2006\Travail\CF\CF2\CompilV2 : containsBorland.Delphi.System.dcuil and the dcpil files of the dll that have beenrecompiled for V2 CF with the three following batches : Compil1.bat,Compil2.bat, Compil3.batDirectory of C:\Delphi2006\Travail\CF\CF2\CompilV227/06/2008 10:38 <REP> .27/06/2008 10:38 <REP> ..02/11/2007 13:13 175 670 Borland.Delphi.System.pas02/11/2007 17:48 593 Compil1.bat02/11/2007 17:49 524 Compil2.bat02/11/2007 15:25 399 Compil3.bat02/11/2007 17:51 <REP> testV202/11/2007 13:50 249 xxx.pasXXX.PAS :unit xxx;interfaceuses System.Text, System.IO, System.Runtime.CompilerServices, System.Runtime.InteropServices, System.Diagnostics, System.Globalization, System.Threading, System.Reflection;implementationend.BATCH1 : Compil1.bat@echo offecho PHASE 1 : Compil that create base dcpil in V2echo It's normal to get the message 'Borland.Delphi.System.Dcuil not found'at the end of the processecho but the dcpil are well generatedecho.pauseCall "C:\ProgramFiles\Borland\BDS\4.0\bin\Dccil.exe" -LU"C:\CF2\Microsoft.WindowsCE.Forms.dll;C:\CF2\Microsoft.VisualBasic.dll;C:\CF2\CustomMarshalers.dll;C:\CF2\mscorlib.dll;C:\CF2\System.dll;C:\CF2\System.Xml.dll;C:\CF2\System.Windows.Forms.dll;C:\CF2\System.Data.dll;C:\CF2\System.Drawing.dll" -DCF -CC --clrversion:v2.0.50727 --no-config -M -y -Z -$D- xxx.paspauseBATCH2 : Compil2.bat@echo offecho PHASE 2 : Compil that create the other dcpils in V2echo It's normal to get the message 'Borland.Delphi.System.Dcuil not found'at the end of the processecho but the dcpil are well generatedecho.pauseCall "C:\ProgramFiles\Borland\BDS\4.0\bin\Dccil.exe" -LU"C:\CF2\System.Windows.Forms.DataGrid.dll;C:\CF2\System.Web.Services.dll;C:\CF2\System.Net.IrDA.dll;C:\CF2\System.Messaging.dll;C:\CF2\Microsoft.WindowsMobile.DirectX.dll" -DCF -CC --clrversion:v2.0.50727 --no-config -Q -M -y -Z -$D- xxx.paspauseBATCH3 : Compil3.bat@echo offecho PHASE3 : Compil that create Borland.Delphi.System.dcuil in V2echo It's normal to get the message 'RuntimeClassConstructor not found'during the processecho because it doesnt exist in CFecho but the dcuil is well generatedecho.pauseCall "C:\ProgramFiles\Borland\BDS\4.0\bin\Dccil.exe" -DCF -CC --clrversion:v2.0.50727 --no-config -Q -M -y -Z -$D- Borland.Delphi.System.paspause----------------------> After having lauched Compil1, Compil2 and Compil3the directory will look as follow :Directory of C:\Delphi2006\Travail\CF\CF2\CompilV227/06/2008 10:38 <REP> .27/06/2008 10:38 <REP> ..02/11/2007 15:38 256 880 Borland.Delphi.System.dcuil02/11/2007 13:13 175 670 Borland.Delphi.System.pas02/11/2007 17:48 593 Compil1.bat02/11/2007 17:49 524 Compil2.bat02/11/2007 15:25 399 Compil3.bat02/11/2007 15:37 2 487 CustomMarshalers.dcpil02/11/2007 15:37 81 605 Microsoft.VisualBasic.dcpil02/11/2007 15:37 28 181 Microsoft.WindowsCE.Forms.dcpil02/11/2007 15:37 247 101 Microsoft.WindowsMobile.DirectX.dcpil02/11/2007 15:37 639 934 mscorlib.dcpil02/11/2007 15:37 352 876 System.Data.dcpil02/11/2007 15:37 256 279 System.dcpil02/11/2007 15:37 69 744 System.Drawing.dcpil02/11/2007 15:37 58 878 System.Messaging.dcpil02/11/2007 15:37 8 402 System.Net.IrDA.dcpil02/11/2007 15:37 46 180 System.Web.Services.dcpil02/11/2007 15:37 21 697 System.Windows.Forms.DataGrid.dcpil02/11/2007 15:37 253 868 System.Windows.Forms.dcpil02/11/2007 15:37 298 972 System.Xml.dcpil02/11/2007 17:51 <REP> testV202/11/2007 13:50 249 xxx.pasAPPLICATION FILES :(A) C:\Delphi2006\Travail\CF\CF2\CompilV2\TestV2 \Project.Dprprogram Project1;//Those five lines are ignored when you use DCCIL directly, they are for theIDE{%DelphiDotNetAssemblyCompiler'$(SystemRoot)\microsoft.net\framework\v1.1.4322\System.dll'}{%DelphiDotNetAssemblyCompiler'$(SystemRoot)\microsoft.net\framework\v1.1.4322\System.Data.dll'}{%DelphiDotNetAssemblyCompiler'$(SystemRoot)\microsoft.net\framework\v1.1.4322\System.Drawing.dll'}{%DelphiDotNetAssemblyCompiler'$(SystemRoot)\microsoft.net\framework\v1.1.4322\System.Windows.Forms.dll'}{%DelphiDotNetAssemblyCompiler'$(SystemRoot)\microsoft.net\framework\v1.1.4322\System.XML.dll'}{$R 'WinForm.TWinForm.resources' 'WinForm.resx'}uses System.Reflection, System.Runtime.CompilerServices, System.Runtime.InteropServices, System.Windows.Forms, WinForm in 'WinForm.pas' {WinForm.TWinForm: System.Windows.Forms.Form};{$R *.res}{$REGION 'Program/Assembly Information'}[assembly: AssemblyDescription('')][assembly: AssemblyConfiguration('')][assembly: AssemblyCompany('')][assembly: AssemblyProduct('')][assembly: AssemblyCopyright('')][assembly: AssemblyTrademark('')][assembly: AssemblyCulture('')][assembly: AssemblyVersion('1.0.*')][assembly: AssemblyDelaySign(false)][assembly: AssemblyKeyFile('')][assembly: AssemblyKeyName('')][assembly: ComVisible(False)]//[assembly: Guid('')]//[assembly: TypeLibVersion(1, 0)]{$ENDREGION}//[STAThread] *****************DO NOT FORGET DO PUT THIS LINE INCOMMENTS******************************begin Application.Run(TWinForm.Create);end.(B) C:\Delphi2006\Travail\CF\CF2\CompilV2\TestV2 \Winform.pasunit WinForm;interfaceuses System.Drawing, System.Collections, System.ComponentModel, System.Windows.Forms, System.Data,Microsoft.win32;type TWinForm = class(System.Windows.Forms.Form) {$REGION 'Designer Managed Code'} strict private /// <summary> /// Required designer variable. /// </summary> Components: System.ComponentModel.Container; Button1: System.Windows.Forms.Button; /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> procedure InitializeComponent; procedure Button1_Click(sender: System.Object; e: System.EventArgs); {$ENDREGION} strict protected /// <summary> /// Clean up any resources being used. /// </summary> procedure Dispose(Disposing: Boolean); override; private { Private Declarations } public constructor Create; end; [assembly: RuntimeRequiredAttribute(TypeOf(TWinForm))]implementation{$AUTOBOX ON}{$REGION 'Windows Form Designer generated code'}/// <summary>/// Required method for Designer support -- do not modify/// the contents of this method with the code editor./// </summary>procedure TWinForm.InitializeComponent;begin Self.Button1 := System.Windows.Forms.Button.Create; Self.SuspendLayout; // // Button1 // Self.Button1.Location := System.Drawing.Point.Create(48, 56); Self.Button1.Name := 'Button1'; Self.Button1.Size := System.Drawing.Size.Create(152, 56); Self.Button1.TabIndex := 0; Self.Button1.Text := 'Button1'; Include(Self.Button1.Click, Self.Button1_Click); // // TWinForm // //Self.AutoScaleBaseSize := System.Drawing.Size.Create(6, 15); Self.ClientSize := System.Drawing.Size.Create(240, 224); Self.Controls.Add(Self.Button1); Self.FormBorderStyle :=System.Windows.Forms.FormBorderStyle.SizableToolWindow; Self.Name := 'TWinForm'; Self.Text := 'WinForm'; Self.ResumeLayout(False);end;{$ENDREGION}procedure TWinForm.Dispose(Disposing: Boolean);begin if Disposing then begin if Components <> nil then Components.Dispose(); end; inherited Dispose(Disposing);end;constructor TWinForm.Create;begin inherited Create; InitializeComponent;end;procedure TWinForm.Button1_Click(sender: System.Object; e:System.EventArgs);var uneclef:registrykey;begin //the registry class doesn't exist in CF 1, only in CF 2 and above uneclef:=Registry.CurrentUser.CreateSubKey('EssaiV2'); uneclef.close;end;end.
Tim,
i've managed to compile a 2.0 CF project with the DCCIL.exe shipped with
Delphi 2006.
i've not tried to compile with the one shipped with Delphi 2007.
it would be interesting for many to know if it works.
Lionel
before launching CfProjCompileV2.Bat, you have to build your CF platform by
launching Compil1.bat, Compil2.bat, Compil3.bat, see below ( you need
Borland.Delphi.System.pas )
CfProjCompileV2.Bat : Compile a CF V2 project ( DPR and Winform.pas are at
the end of this mail)
@echo off
del C:\Delphi2006\Travail\CF\CF2\CompilV2\TestV2\*.dcuil
del C:\Delphi2006\Travail\CF\CF2\CompilV2\TestV2\*.dcpil
Call "C:\Program
Files\Borland\BDS\4.0\bin\Dccil.exe" --clrversion:v2.0.50727
"C:\Delphi2006\Travail\CF\CF2\CompilV2\TestV2\Project1.Dpr" -U"C:\Delphi2006\Travail\CF\CF2\CompilV2"
-LU"C:\CF2\System.dll;C:\CF2\System.Xml.dll;C:\CF2\System.Windows.Forms.dll;C:\CF2\System.Data.dll;C:\CF2\System.Drawing.dll" -DCF -X"C:\Delphi2006\Travail\CF\CF2\CompilV2\TestV2\ProjCFV2.Exe"pauseexplanation of directories :(1) directory C:\Delphi2006\Travail\CF\CF2\CompilV2\TestV2 : containstheproject to compile (Project1.Dpr)Directory of C:\Delphi2006\Travail\CF\CF2\CompilV2\testV227/06/2008 10:53 <REP> .27/06/2008 10:53 <REP> ..02/11/2007 17:51 510 CfProjCompileV2.Bat02/11/2007 11:06 10 789 Project1.bdsproj02/11/2007 11:06 742 Project1.bdsproj.local02/11/2007 11:06 677 Project1.cfg02/11/2007 11:06 3 970 Project1.dpr02/11/2007 10:58 4 396 Project1.res02/11/2007 11:06 164 Project1.rsp02/11/2007 16:37 5 236 WinForm.dcuil02/11/2007 16:37 2 691 WinForm.pas02/11/2007 16:04 6 538 WinForm.resx02/11/2007 16:07 3 248 WinForm.TWinForm.resources(2) directory C:\CF2 : contains the V2 dll's that you have to extractfromthe PDA, they are in the \windows directory ( their name start withGAC...,copy them to your PC and rename them )Directory of C:\CF227/06/2008 10:34 <REP> .27/06/2008 10:34 <REP> ..09/05/2006 14:59 14 296 CustomMarshalers.dll09/05/2006 14:59 351 200 Microsoft.VisualBasic.dll09/05/2006 14:59 31 208 Microsoft.WindowsCE.Forms.dll09/05/2006 14:59 183 288 Microsoft.WindowsMobile.DirectX.dll09/05/2006 14:59 909 768 mscorlib.dll09/05/2006 14:59 693 712 System.Data.dll09/05/2006 14:59 463 296 System.dll09/05/2006 14:59 58 320 System.Drawing.dll09/05/2006 14:59 75 224 System.Messaging.dll09/05/2006 14:59 17 368 System.Net.IrDA.dll09/05/2006 14:59 62 944 System.Web.Services.dll09/05/2006 14:59 49 648 System.Windows.Forms.DataGrid.dll09/05/2006 14:59 240 608 System.Windows.Forms.dll09/05/2006 14:59 1 027 528 System.Xml.dll(3) directory C:\Delphi2006\Travail\CF\CF2\CompilV2 :containsBorland.Delphi.System.dcuil and the dcpil files of the dll that havebeenrecompiled for V2 CF with the three following batches :Compil1.bat,Compil2.bat, Compil3.batDirectory of C:\Delphi2006\Travail\CF\CF2\CompilV227/06/2008 10:38 <REP> .27/06/2008 10:38 <REP> ..02/11/2007 13:13 175 670 Borland.Delphi.System.pas02/11/2007 17:48 593 Compil1.bat02/11/2007 17:49 524 Compil2.bat02/11/2007 15:25 399 Compil3.bat02/11/2007 17:51 <REP> testV202/11/2007 13:50 249 xxx.pasXXX.PAS :unit xxx;interfaceuses System.Text, System.IO, System.Runtime.CompilerServices, System.Runtime.InteropServices, System.Diagnostics, System.Globalization, System.Threading, System.Reflection;implementationend.BATCH1 : Compil1.bat@echo offecho PHASE 1 : Compil that create base dcpil in V2echo It's normal to get the message 'Borland.Delphi.System.Dcuil notfound'at the end of the processecho but the dcpil are well generatedecho.pauseCall "C:\ProgramFiles\Borland\BDS\4.0\bin\Dccil.exe" -LU"C:\CF2\Microsoft.WindowsCE.Forms.dll;C:\CF2\Microsoft.VisualBasic.dll;C:\CF2\CustomMarshalers.dll;C:\CF2\mscorlib.dll;C:\CF2\System.dll;C:\CF2\System.Xml.dll;C:\CF2\System.Windows.Forms.dll;C:\CF2\System.Data.dll;C:\CF2\System.Drawing.dll" -DCF -CC --clrversion:v2.0.50727 --no-config -M -y -Z -$D- xxx.paspauseBATCH2 : Compil2.bat@echo offecho PHASE 2 : Compil that create the other dcpils in V2echo It's normal to get the message 'Borland.Delphi.System.Dcuil notfound'at the end of the processecho but the dcpil are well generatedecho.pauseCall "C:\ProgramFiles\Borland\BDS\4.0\bin\Dccil.exe" -LU"C:\CF2\System.Windows.Forms.DataGrid.dll;C:\CF2\System.Web.Services.dll;C:\CF2\System.Net.IrDA.dll;C:\CF2\System.Messaging.dll;C:\CF2\Microsoft.WindwsMobile.DirectX.dll" -DCF -CC --clrversion:v2.0.50727 --no-config -Q -M -y -Z -$D- xxx.paspauseBATCH3 : Compil3.bat@echo offecho PHASE3 : Compil that create Borland.Delphi.System.dcuil in V2echo It's normal to get the message 'RuntimeClassConstructor notfound'during the processecho because it doesnt exist in CFecho but the dcuil is well generatedecho.pauseCall"C:\ProgramFiles\Borland\BDS\4.0\bin\Dccil.exe" -DCF -CC --clrversion:v2.0.50727 --no-config -Q -M -y -Z -$D- Borland.Delphi.System.paspause----------------------> After having lauched Compil1, Compil2 and Compil3thedirectory will look as follow :Directory of C:\Delphi2006\Travail\CF\CF2\CompilV227/06/2008 10:38 <REP> .27/06/2008 10:38 <REP> ..02/11/2007 15:38 256 880 Borland.Delphi.System.dcuil02/11/2007 13:13 175 670 Borland.Delphi.System.pas02/11/2007 17:48 593 Compil1.bat02/11/2007 17:49 524 Compil2.bat02/11/2007 15:25 399 Compil3.bat02/11/2007 15:37 2 487 CustomMarshalers.dcpil02/11/2007 15:37 81 605 Microsoft.VisualBasic.dcpil02/11/2007 15:37 28 181 Microsoft.WindowsCE.Forms.dcpil02/11/2007 15:37 247 101 Microsoft.WindowsMobile.DirectX.dcpil02/11/2007 15:37 639 934 mscorlib.dcpil02/11/2007 15:37 352 876 System.Data.dcpil02/11/2007 15:37 256 279 System.dcpil02/11/2007 15:37 69 744 System.Drawing.dcpil02/11/2007 15:37 58 878 System.Messaging.dcpil02/11/2007 15:37 8 402 System.Net.IrDA.dcpil02/11/2007 15:37 46 180 System.Web.Services.dcpil02/11/2007 15:37 21 697 System.Windows.Forms.DataGrid.dcpil02/11/2007 15:37 253 868 System.Windows.Forms.dcpil02/11/2007 15:37 298 972 System.Xml.dcpil02/11/2007 17:51 <REP> testV202/11/2007 13:50 249 xxx.pasAPPLICATION FILES :(A) C:\Delphi2006\Travail\CF\CF2\CompilV2\TestV2\Project.Dprprogram Project1;//Those five lines are ignored when you use DCCIL directly, they are fortheIDE{%DelphiDotNetAssemblyCompiler'$(SystemRoot)\microsoft.net\framework\v1.1.4322\System.dll'}{%DelphiDotNetAssemblyCompiler'$(SystemRoot)\microsoft.net\framework\v1.1.4322\System.Data.dll'}{%DelphiDotNetAssemblyCompiler'$(SystemRoot)\microsoft.net\framework\v1.1.4322\System.Drawing.dll'}{%DelphiDotNetAssemblyCompiler'$(SystemRoot)\microsoft.net\framework\v1.1.4322\System.Windows.Forms.dll'}{%DelphiDotNetAssemblyCompiler'$(SystemRoot)\microsoft.net\framework\v1.1.4322\System.XML.dll'}{$R 'WinForm.TWinForm.resources' 'WinForm.resx'}uses System.Reflection, System.Runtime.CompilerServices, System.Runtime.InteropServices, System.Windows.Forms, WinForm in 'WinForm.pas'{WinForm.TWinForm: System.Windows.Forms.Form};{$R *.res}{$REGION 'Program/Assembly Information'}[assembly: AssemblyDescription('')][assembly: AssemblyConfiguration('')][assembly: AssemblyCompany('')][assembly: AssemblyProduct('')][assembly: AssemblyCopyright('')][assembly: AssemblyTrademark('')][assembly: AssemblyCulture('')][assembly: AssemblyVersion('1.0.*')][assembly: AssemblyDelaySign(false)][assembly: AssemblyKeyFile('')][assembly: AssemblyKeyName('')][assembly: ComVisible(False)]//[assembly: Guid('')]//[assembly: TypeLibVersion(1, 0)]{$ENDREGION}//[STAThread] *****************DO NOT FORGET DO PUT THIS LINEINCOMMENTS******************************beginApplication.Run(TWinForm.Create);end.(B) C:\Delphi2006\Travail\CF\CF2\CompilV2\TestV2\Winform.pasunit WinForm;interfaceuses System.Drawing, System.Collections, System.ComponentModel, System.Windows.Forms, System.Data, Microsoft.win32;type TWinForm = class(System.Windows.Forms.Form){$REGION 'Designer Managed Code'}strict private/// <summary>/// Required designer variable./// </summary>Components: System.ComponentModel.Container;Button1: System.Windows.Forms.Button;/// <summary>/// Required method for Designer support - do not modify/// the contents of this method with the code editor./// </summary>prcedure InitializeComponent;procedure Button1_Click(sender: System.Object; e.EventArgs);{$ENDREGION}strict protected/// <summary>/// Clean up any resources being used./// </summary>procedure Dispose(Disposing: Boolean); override;private{ Private Declarations }public constructor Create;end;[assembly: RuntimeRequiredAttribute(TypeOf(TWinForm))]implementation{$AUTOBOX ON}{$REGION 'Windows Form Designer generated code'}/// <summary>/// Required method for Designer support -- do not modify/// the contents of this method with the code editor./// </summary>procedure TWinForm.InitializeComponent;beginSelf.Button1 := System.Windows.Forms.Button.Create;Self.SuspendLayout;//// Button1// Self.Button1.Location := System.Drawing.Point.Create(48, 56);Self.Button1.Name := 'Button1';Self.Button1.Size := System.Drawing.Size.Create(152, 56);Self.Button1.TabIndex := 0;Self.Button1.Text := 'Button1';Include(Self.Button1.Click, Self.Button1_Click);//// TWinForm////Self.AutoScaleBaseSize := System.Drawing.Size.Create(6, 15);Self.ClientSize := System.Drawing.Size.Create(240, 224);Self.Controls.Add(Self.Button1);Self.FormBorderStyle:=System.Windows.Forms.FormBorderStyle.SizableToolWindow;Self.Name := 'TWinForm';Self.Text := 'WinForm';Self.ResumeLayout(False);end;{$ENDREGION}procedure TWinForm.Dispose(Disposing: Boolean);beginif Disposing then begin if Components <> nil then Components.Dispose(); end; inherited Dispose(Disposing);end;constructor TWinForm.Create;begin inherited Create; InitializeComponent;end;procedure TWinForm.Button1_Click(sender: System.Object; e:System.EventArgs);var uneclef:registrykey;begin //the registry class doesn't exist in CF 1, only in CF 2 and above uneclef:=Registry.CurrentUser.CreateSubKey('EssaiV2'); uneclef.close; end;end.
Tim,
i've managed to compile a 2.0 CF project with the DCCIL.exe shipped with
Delphi 2006.
i've not tried to compile with the one shipped with Delphi 2007.
it would be interesting for many to know if it works.
Lionel
before launching CfProjCompileV2.Bat, you have to build your CF platform by
launching Compil1.bat, Compil2.bat, Compil3.bat, see below ( you need
Borland.Delphi.System.pas )
CfProjCompileV2.Bat : Compile a CF V2 project ( DPR and Winform.pas are at
the end of this mail)
@echo off
del C:\Delphi2006\Travail\CF\CF2\CompilV2\TestV2\*.dcuil
del C:\Delphi2006\Travail\CF\CF2\CompilV2\TestV2\*.dcpil
Call "C:\Program
Files\Borland\BDS\4.0\bin\Dccil.exe" --clrversion:v2.0.50727
"C:\Delphi2006\Travail\CF\CF2\CompilV2\TestV2\Project1.Dpr" -U"C:\Delphi2006\Travail\CF\CF2\CompilV2"
-LU"C:\CF2\System.dll;C:\CF2\System.Xml.dll;C:\CF2\System.Windows.Forms.dll;C:\CF2\System.Data.dll;C:\CF2\System.Drawing.dll" -DCF -X"C:\Delphi2006\Travail\CF\CF2\CompilV2\TestV2\ProjCFV2.Exe"pauseexplanation of directories :(1) directory C:\Delphi2006\Travail\CF\CF2\CompilV2\TestV2 : containstheproject to compile (Project1.Dpr)Directory of C:\Delphi2006\Travail\CF\CF2\CompilV2\testV227/06/2008 10:53 <REP> .27/06/2008 10:53 <REP> ..02/11/2007 17:51 510 CfProjCompileV2.Bat02/11/2007 11:06 10 789 Project1.bdsproj02/11/2007 11:06 742 Project1.bdsproj.local02/11/2007 11:06 677 Project1.cfg02/11/2007 11:06 3 970 Project1.dpr02/11/2007 10:58 4 396 Project1.res02/11/2007 11:06 164 Project1.rsp02/11/2007 16:37 5 236 WinForm.dcuil02/11/2007 16:37 2 691 WinForm.pas02/11/2007 16:04 6 538 WinForm.resx02/11/2007 16:07 3 248 WinForm.TWinForm.resources(2) directory C:\CF2 : contains the V2 dll's that you have to extractfromthe PDA, they are in the \windows directory ( their name start withGAC...,copy them to your PC and rename them )Directory of C:\CF227/06/2008 10:34 <REP> .27/06/2008 10:34 <REP> ..09/05/2006 14:59 14 296 CustomMarshalers.dll09/05/2006 14:59 351 200 Microsoft.VisualBasic.dll09/05/2006 14:59 31 208 Microsoft.WindowsCE.Forms.dll09/05/2006 14:59 183 288 Microsoft.WindowsMobile.DirectX.dll09/05/2006 14:59 909 768 mscorlib.dll09/05/2006 14:59 693 712 System.Data.dll09/05/2006 14:59 463 296 System.dll09/05/2006 14:59 58 320 System.Drawing.dll09/05/2006 14:59 75 224 System.Messaging.dll09/05/2006 14:59 17 368 System.Net.IrDA.dll09/05/2006 14:59 62 944 System.Web.Services.dll09/05/2006 14:59 49 648 System.Windows.Forms.DataGrid.dll09/05/2006 14:59 240 608 System.Windows.Forms.dll09/05/2006 14:59 1 027 528 System.Xml.dll(3) directory C:\Delphi2006\Travail\CF\CF2\CompilV2 :containsBorland.Delphi.System.dcuil and the dcpil files of the dll that havebeenrecompiled for V2 CF with the three following batches :Compil1.bat,Compil2.bat, Compil3.batDirectory of C:\Delphi2006\Travail\CF\CF2\CompilV227/06/2008 10:38 <REP> .27/06/2008 10:38 <REP> ..02/11/2007 13:13 175 670 Borland.Delphi.System.pas02/11/2007 17:48 593 Compil1.bat02/11/2007 17:49 524 Compil2.bat02/11/2007 15:25 399 Compil3.bat02/11/2007 17:51 <REP> testV202/11/2007 13:50 249 xxx.pasXXX.PAS :unit xxx;interfaceuses System.Text, System.IO, System.Runtime.CompilerServices, System.Runtime.InteropServices, System.Diagnostics, System.Globalization, System.Threading, System.Reflection;implementationend.BATCH1 : Compil1.bat@echo offecho PHASE 1 : Compil that create base dcpil in V2echo It's normal to get the message 'Borland.Delphi.System.Dcuil notfound'at the end of the processecho but the dcpil are well generatedecho.pauseCall "C:\ProgramFiles\Borland\BDS\4.0\bin\Dccil.exe" -LU"C:\CF2\Microsoft.WindowsCE.Forms.dll;C:\CF2\Microsoft.VisualBasic.dll;C:\CF2\CustomMarshalers.dll;C:\CF2\mscorlib.dll;C:\CF2\System.dll;C:\CF2\System.Xml.dll;C:\CF2\System.Windows.Forms.dll;C:\CF2\System.Data.dll;C:\CF2\System.Drawing.dll" -DCF -CC --clrversion:v2.0.50727 --no-config -M -y -Z -$D- xxx.paspauseBATCH2 : Compil2.bat@echo offecho PHASE 2 : Compil that create the other dcpils in V2echo It's normal to get the message 'Borland.Delphi.System.Dcuil notfound'at the end of the processecho but the dcpil are well generatedecho.pauseCall "C:\ProgramFiles\Borland\BDS\4.0\bin\Dccil.exe" -LU"C:\CF2\System.Windows.Forms.DataGrid.dll;C:\CF2\System.Web.Services.dll;C:\CF2\System.Net.IrDA.dll;C:\CF2\System.Messaging.dll;C:\CF2\Microsoft.WindwsMobile.DirectX.dll" -DCF -CC --clrversion:v2.0.50727 --no-config -Q -M -y -Z -$D- xxx.paspauseBATCH3 : Compil3.bat@echo offecho PHASE3 : Compil that create Borland.Delphi.System.dcuil in V2echo It's normal to get the message 'RuntimeClassConstructor notfound'during the processecho because it doesnt exist in CFecho but the dcuil is well generatedecho.pauseCall"C:\ProgramFiles\Borland\BDS\4.0\bin\Dccil.exe" -DCF -CC --clrversion:v2.0.50727 --no-config -Q -M -y -Z -$D- Borland.Delphi.System.paspause----------------------> After having lauched Compil1, Compil2 and Compil3thedirectory will look as follow :Directory of C:\Delphi2006\Travail\CF\CF2\CompilV227/06/2008 10:38 <REP> .27/06/2008 10:38 <REP> ..02/11/2007 15:38 256 880 Borland.Delphi.System.dcuil02/11/2007 13:13 175 670 Borland.Delphi.System.pas02/11/2007 17:48 593 Compil1.bat02/11/2007 17:49 524 Compil2.bat02/11/2007 15:25 399 Compil3.bat02/11/2007 15:37 2 487 CustomMarshalers.dcpil02/11/2007 15:37 81 605 Microsoft.VisualBasic.dcpil02/11/2007 15:37 28 181 Microsoft.WindowsCE.Forms.dcpil02/11/2007 15:37 247 101 Microsoft.WindowsMobile.DirectX.dcpil02/11/2007 15:37 639 934 mscorlib.dcpil02/11/2007 15:37 352 876 System.Data.dcpil02/11/2007 15:37 256 279 System.dcpil02/11/2007 15:37 69 744 System.Drawing.dcpil02/11/2007 15:37 58 878 System.Messaging.dcpil02/11/2007 15:37 8 402 System.Net.IrDA.dcpil02/11/2007 15:37 46 180 System.Web.Services.dcpil02/11/2007 15:37 21 697 System.Windows.Forms.DataGrid.dcpil02/11/2007 15:37 253 868 System.Windows.Forms.dcpil02/11/2007 15:37 298 972 System.Xml.dcpil02/11/2007 17:51 <REP> testV202/11/2007 13:50 249 xxx.pasAPPLICATION FILES :(A) C:\Delphi2006\Travail\CF\CF2\CompilV2\TestV2\Project.Dprprogram Project1;//Those five lines are ignored when you use DCCIL directly, they are fortheIDE{%DelphiDotNetAssemblyCompiler'$(SystemRoot)\microsoft.net\framework\v1.1.4322\System.dll'}{%DelphiDotNetAssemblyCompiler'$(SystemRoot)\microsoft.net\framework\v1.1.4322\System.Data.dll'}{%DelphiDotNetAssemblyCompiler'$(SystemRoot)\microsoft.net\framework\v1.1.4322\System.Drawing.dll'}{%DelphiDotNetAssemblyCompiler'$(SystemRoot)\microsoft.net\framework\v1.1.4322\System.Windows.Forms.dll'}{%DelphiDotNetAssemblyCompiler'$(SystemRoot)\microsoft.net\framework\v1.1.4322\System.XML.dll'}{$R 'WinForm.TWinForm.resources' 'WinForm.resx'}uses System.Reflection, System.Runtime.CompilerServices, System.Runtime.InteropServices, System.Windows.Forms, WinForm in 'WinForm.pas'{WinForm.TWinForm: System.Windows.Forms.Form};{$R *.res}{$REGION 'Program/Assembly Information'}[assembly: AssemblyDescription('')][assembly: AssemblyConfiguration('')][assembly: AssemblyCompany('')][assembly: AssemblyProduct('')][assembly: AssemblyCopyright('')][assembly: AssemblyTrademark('')][assembly: AssemblyCulture('')][assembly: AssemblyVersion('1.0.*')][assembly: AssemblyDelaySign(false)][assembly: AssemblyKeyFile('')][assembly: AssemblyKeyName('')][assembly: ComVisible(False)]//[assembly: Guid('')]//[assembly: TypeLibVersion(1, 0)]{$ENDREGION}//[STAThread] *****************DO NOT FORGET DO PUT THIS LINEINCOMMENTS******************************beginApplication.Run(TWinForm.Create);end.(B) C:\Delphi2006\Travail\CF\CF2\CompilV2\TestV2\Winform.pasunit WinForm;interfaceuses System.Drawing, System.Collections, System.ComponentModel, System.Windows.Forms, System.Data, Microsoft.win32;type TWinForm = class(System.Windows.Forms.Form){$REGION 'Designer Managed Code'}strict private/// <summary>/// Required designer variable./// </summary>Components: System.ComponentModel.Container;Button1: System.Windows.Forms.Button;/// <summary>/// Required method for Designer support - do not modify/// the contents of this method with the code editor./// </summary>prcedure InitializeComponent;procedure Button1_Click(sender: System.Object; e.EventArgs);{$ENDREGION}strict protected/// <summary>/// Clean up any resources being used./// </summary>procedure Dispose(Disposing: Boolean); override;private{ Private Declarations }public constructor Create;end;[assembly: RuntimeRequiredAttribute(TypeOf(TWinForm))]implementation{$AUTOBOX ON}{$REGION 'Windows Form Designer generated code'}/// <summary>/// Required method for Designer support -- do not modify/// the contents of this method with the code editor./// </summary>procedure TWinForm.InitializeComponent;beginSelf.Button1 := System.Windows.Forms.Button.Create;Self.SuspendLayout;//// Button1// Self.Button1.Location := System.Drawing.Point.Create(48, 56);Self.Button1.Name := 'Button1';Self.Button1.Size := System.Drawing.Size.Create(152, 56);Self.Button1.TabIndex := 0;Self.Button1.Text := 'Button1';Include(Self.Button1.Click, Self.Button1_Click);//// TWinForm////Self.AutoScaleBaseSize := System.Drawing.Size.Create(6, 15);Self.ClientSize := System.Drawing.Size.Create(240, 224);Self.Controls.Add(Self.Button1);Self.FormBorderStyle:=System.Windows.Forms.FormBorderStyle.SizableToolWindow;Self.Name := 'TWinForm';Self.Text := 'WinForm';Self.ResumeLayout(False);end;{$ENDREGION}procedure TWinForm.Dispose(Disposing: Boolean);beginif Disposing then begin if Components <> nil then Components.Dispose(); end; inherited Dispose(Disposing);end;constructor TWinForm.Create;begin inherited Create; InitializeComponent;end;procedure TWinForm.Button1_Click(sender: System.Object; e:System.EventArgs);var uneclef:registrykey;begin //the registry class doesn't exist in CF 1, only in CF 2 and above uneclef:=Registry.CurrentUser.CreateSubKey('EssaiV2'); uneclef.close; end;end.
Post to the attachments group.
<< i've managed to compile a 2.0 CF project with the DCCIL.exe shipped with
Delphi 2006.
i've not tried to compile with the one shipped with Delphi 2007.
it would be interesting for many to know if it works. >>
Thanks very much, I'll check that out and see if I get any difference in the
results. I'll let you know what I find out.
Unfortunately, the result is the same. I copied over the assemblies from
the Windows Mobile 6 Professional Emulator image, just to make sure that I
was building the .dcpil files against the correct assemblies. And then I
ran the batch file that I posted earlier to rebuild the .dcpil and .dcuil
files (deleted the old ones first), and the result is the same -
NullReferenceExceptions where there should be none.
I was somewhat incorrect in saying that the NullReferenceException was
coming from this code:
if (not (Token.TokenType in Expected)) then
ExpectedTokenTypes(Token,Expected);
What happens is that the Token.TokenType is actually in the Expected set,
but for some reason the in operator does not work correctly, and the
ExpectedTokenTypes method is called, and that is where the NULL reference
exception is occurring. The NullReferenceException is still not valid, but
the initial cause is the failure of the in operator.
> but for some reason the in operator does not work correctly
The IL looks correct, I would suspect that there is something
happening with the fact that the set is wider than a normal int32.
Maybe the set is being truncated or if this is the 64th bit then it is
being treated as signed and truncated. You should be able to step
through the IL and see this.
> The IL looks correct, I would suspect that there is something
> happening with the fact that the set is wider than a normal int32.
> Maybe the set is being truncated or if this is the 64th bit then it is
> being treated as signed and truncated. You should be able to step
> through the IL and see this.
I found this:
http://tinyurl.com/5eby9k
Note the comment about 64 bits and SHL.
<< I found this:
http://tinyurl.com/5eby9k
Note the comment about 64 bits and SHL. >>
Beautiful. I think you hit the mother lode. <g>
I knew I was going to have to come up with a workaround for this, but I
first wanted to see what the actual issue was first. I'm not really the
type of programmer to just ignore the "why" of the situation. <g>
Of course, the big question would be why does this work when running with
the CF on the desktop ? I suppose I'll answer that when I step through the
IL and see what's going on.
Thanks very much,
> Of course, the big question would be why does this work when running with
> the CF on the desktop ? I suppose I'll answer that when I step through the
> IL and see what's going on.
Even though running on the desktop will probably pull in the CF
assemblies, you are still using the desktop CLR, Runtime Engine and
JITter. You are also probably using the full version of the mscorlib
assembly and not the CF one.
<< Even though running on the desktop will probably pull in the CF
assemblies, you are still using the desktop CLR, Runtime Engine and JITter.
You are also probably using the full version of the mscorlib assembly and
not the CF one. >>
Yeah, that makes sense.
Anyways, I went ahead and modified the set testing, etc. so that it uses an
open array and looks like this instead:
procedure TEDBExprValidater.CheckTokenType(Token: TEDBExprToken;
const Expected: array of
TEDBTokenType);
var
I: Integer;
TempFound: Boolean;
begin
TempFound:=False;
for I:=0 to Length(Expected)-1 do
begin
if (Token.TokenType=Expected[I]) then
begin
TempFound:=True;
Break;
end;
end;
if (not TempFound) then
ExpectedTokenTypes(Token,Expected);
end;
And, surprise, surpise, the whole thing works great now !!!
So, I owe you a few beers if you're ever in the western NY/Buffalo area. <g>
Thanks very much for all of your help,
> Thanks very much for all of your help,
No problem.