Hi,
My problem is described pretty much in the title. I am using VS 2005.
I have some code to use in a Pocket PC 2003 application and it is written
in C/C++. What is the suggested way to do this
I tried to use the DLL in a PPC project but since it is desktop DLL, i failed to do that. I tried to compile the code in a Smart Device project, i failed to do that too (couldn't find files like wincon.h, io.h, etc)...This code was written to be used in desktop applications.
I think this must be a frequent problem that Smart Device developers encounter but I really
couldn't find a way to solve this either through forum-search or google.
Thanks for any help...

Legacy Win32 C/C++ Code to be used in CF
volverine
Hi
You'll have to port the DLL to the Windows Mobile platform. On Windows Mobile only a subset of the Win32 APIs are available.
Create a new Smart Device DLL project and add your sources. Compile and start fixing compiler errors.
A missing header file usually means that some APIs used are not available on Windows Mobile.
Tomys
Zulkhairi
I believe you need to add a "Win32 Smart Device Project" to your existing CF project (open your CF project, File->Add->New Project; then under Other Languages -> Visual C++ -> Smart Device). Then in the Project Wizard, set the platforms you need and change the Application type to DLL and set any additional settings you need (for MFC, ATL, etc). Then just add your existing code to that project and recompile. Then you should be able to pinvoke into that dll like any other native dll.
Hope that helps,
--Jeff
aka_Big_Wurm
"...Compile and start fixing compiler errors..."
Actually this is what I was doing to solve the problem and I was hoping that there might be another (and neater) solution to this. There are for example FAR declarations in the code which is not recognized by the VS compiler etc etc...
Anyway, I will do it as you suggested.
Thanks guys...
phil_m
Hi
The easiest way to call your native DLL from C# is to use P/Invoke. Details how to do this can be found in MSDN under: Consuming Unmanaged DLL Functions.
Concerning deployment: Deploy your native DLL either to the \Windows directory or to application directory (where you deploy your managed application to).
Hope this helps.
Michael
Daikoku
Now I have a different problem.
What I did:
I created a VC++ Smart Device Win32 DLL project with VS2005. I added all the legacy C/C++ code to the project. Then I got rid of the compiler errors and managed to create the dll.
However now I just remembered that I needed to call this dll file from a Smart Device C# application :))
So as far as know a Win32 DLL cannot be referenced from a CLR application, right Well when I try to add a reference to the Win32 dll from my C# application, VS2005 does not let me do that, which is I suppose quite obvious.
Anyway, what do I do now Is there a way to reference a Win32 DLL from a CLR project in Visual Studio Maybe I should just port my C# application to C++ because it should take a lot less time compared to the legacy code I have.
Cheers.