Creating a Compact Framework DLL using ilasm.exe Assembler
So I'm attempting to modify a Compact Framework to export a C function. It works fine on the Full Framework.
The method being used is described here. https://sites.google.com/site/robertgiesecke/Home/uploads/csharpprojecttemplateforunmanagedexports
Anyway the issue seems to be if I take a Compact Framework Dll disassemble it and then reassemble it it seems to reassemble it as a Full Framework Dll.
Any idea how I can get it to reassemble as a Compact Framework Dll.
There is no reasonable way to make this happen.
The Compact Framework compiler supports C# and VB.NET. Managed C++ was never supported, though in some experimentation it could be made to generate an assembly. The problem is that the CF doesn't support all of the opcodes that .NET in general uses, so even if you manage to get it to build for a CF target, there's no way to guarantee it won't put in unsupported opcodes (the CF compilers do this filtering for you).
The other problem you have is that native code (whatever is loading your DLL) cannot host the CLR in the compact framework - the plumbing for EE Hosting simply doesn't exist outside of a managed application process. So even if you somehow got your DLL to compile, export the entry point and not have any invalid opcodes, the native process would have no way to spin up the EE to load the managed bits in the assembly.