ILASM for Compact Framework 2

B

Buthrakaur

I already asked in CF group, but nobody was able to help me - I hope
someone here would know the answer...

I need to compile some IL code to CF2 class library (.dll). I just
tried it, got the dll using something like
"c:\WINNT\Microsoft.NET\Framework\v2.0.50727\ilasm.exe /DLL mycode.il".

The DLL looks ok on first sight (I can see all the classes using
reflector), but if I add the assembly to my SmartDevice CF2 project in
VS2k5, I'm not able to use the classes. The reference is added without
any error messages, but the compiler doesn't recognize names of the
classes in the assembly if I try to use them...

If I try to use the assembly from WinForms project, everything works
ok. So it looks like the ilasm generates just full-framework compatible

assembly.

Is there any special ilasm.exe tool for compact framework?
 
D

Damien

Buthrakaur said:
I already asked in CF group, but nobody was able to help me - I hope
someone here would know the answer...

I need to compile some IL code to CF2 class library (.dll). I just
tried it, got the dll using something like
"c:\WINNT\Microsoft.NET\Framework\v2.0.50727\ilasm.exe /DLL mycode.il".

The DLL looks ok on first sight (I can see all the classes using
reflector), but if I add the assembly to my SmartDevice CF2 project in
VS2k5, I'm not able to use the classes. The reference is added without
any error messages, but the compiler doesn't recognize names of the
classes in the assembly if I try to use them...

If I try to use the assembly from WinForms project, everything works
ok. So it looks like the ilasm generates just full-framework compatible

assembly.

Is there any special ilasm.exe tool for compact framework?

Hi,

Up front, I'll admit I know nothing about CF, but I decided to look at
it just as a "it might be useful in the future".

I'm still in 1.1 land, so my test was on that framework. I went into
VS2k3, and created a class library application, using the wizard. I
added no code, and compiled. I did this for both a full framework DLL
and a CF DLL. I then used ildasm to pull the two DLLs apart.

The only differences I could find (remember, this is from 1.1, so any
values I give may be different under 2.0:

1) The external assembly references. The CF one includes the keyword
retargetable:
..assembly extern /*23000004*/ retargetable System
whereas the FF one doesn't include that keyword.

2) The external assembly references: Different public key token (96 9D
B8 05 3D 33 22 AC) compared to the FF one of (B7 7A 5C 56 19 34 E0 89 )

Other differences I found in the files, which I don't believe have any
relevance are:
1) Extra attribute added to the FF one
(System.Runtime.InteropServices.GuidAttribute)
2) Different .imagebase

And that was it. Sorry if I've wasted your time if this is all nothing
new to you, but maybe others might be interested.

Damien
 
B

Buthrakaur

Hi Damien,
thank you very much for your interest and time. Your attempt for
searching the solution looks very logical - I'll try this approach in
CF2 envirionment. In my IL code, all the references use retargetable
keyword and the public key should be also ok I think...


..assembly extern retargetable System.Data
{
.publickeytoken = (96 9D B8 05 3D 33 22 AC )
// ....=3".
.ver 2:0:0:0
}
..assembly extern mscorlib
{
.publickeytoken = (96 9D B8 05 3D 33 22 AC )
// ....=3".
.ver 2:0:0:0
}
..assembly extern retargetable System
{
.publickeytoken = (96 9D B8 05 3D 33 22 AC )
// ....=3".
.ver 2:0:0:0
}
..assembly extern retargetable System.Windows.Forms
{
.publickeytoken = (96 9D B8 05 3D 33 22 AC )
// ....=3".
.ver 2:0:0:0
}
..assembly extern Microsoft.WindowsCE.Forms
{
.publickeytoken = (96 9D B8 05 3D 33 22 AC )
// ....=3".
.ver 2:0:0:0
}


I will try to experiment with CF2 vs FF2 class libraries + ILDASM and
hope I will find the exact difference, which is causing the
CF2-incompatibility... I'll report any progress.

regards,

Filip
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top