[C#][VS 2005 Bete 2] creating & using a C++ in a C# project

Hi,
I try to create a unmanaged dll in C++ with visualt studio 2005 and the i want to use it in a c# project.
My first question is hoaw to create a C++ (unmanaged) dll project for smartphone ? in visual stuido 2005. I create a Win32 projecdt>>dll project but i supopose it's only for deskop.

After that i wrote my dll.
.CPP

#include"MyDll.h"
// This is an example of an exported function.
MYDLL_APIint fnMyDll()
{
return 42;}

.H

#ifdef MYDLL_EXPORTS
#define MYDLL_API__declspec(dllexport)
#else
#define MYDLL_API __declspec(dllimport)
#endif
MYDLL_APIint fnMyDll();

Then i use it in my C# project

[DllImport("MyDll.dll",EntryPoint="fnMyDll",CharSet=CharSet.Unicode)]

privatestaticexternint fnMyDll();

int GetInt()

{

return fnMyDll();

}

--

But at run time i get aMissing Methode Exception.
For running my app i direclty dowload the dll in the exe folder, so the exe should find the methode :s

So does anyone knows how to make such a thing (creat a C++ dll project for smartphoen and then use it i a C# project) with visual 2005 ?

[2280 byte] By [lmussier] at [2008-2-15]
# 1
here it is

extern "C"
{
MYDLL_API int fnMyDll();
}

.NET does not supportname mangling :(
To bad..

lmussier at 2007-9-9 > top of Msdn Tech,Smart Device Development,Smart Devices General...
# 2

..or you could use dumpbin to declare the name exactly as it is exported. More here:
http://msdn.microsoft.com/smartclient/understanding/netcf/FAQ/default.aspx#6.0

Cheers
Daniel

DanielMoth at 2007-9-9 > top of Msdn Tech,Smart Device Development,Smart Devices General...
# 3
Yeah thanks for that ;)
And waht about creating simple c++ dll for smartphone in visual studio 2005 ?
I can't make it :)
lmussier at 2007-9-9 > top of Msdn Tech,Smart Device Development,Smart Devices General...
# 4
You have to create a VC++ for SmartDevices project to build this DLL. You can create the project within the same solution as your other project, for convenience. Of course, you have to have VC++ installed for this option to be available.

- Larry

LarryLieberman at 2007-9-9 > top of Msdn Tech,Smart Device Development,Smart Devices General...
# 5
Ok it's working for a smart device dll using MFC, but if a remember well, MFC are not supported under Windows Mobiel 2003 SE !!

So how can i create a simple C++ dll, for the moment i cretae my C++ dll in embedded VC ++ and upload the dll on my real smartphone. The tests are not possible since code for embedded VC++ emulator and Visual Stuidio 2005 emulator are not compatible.

So my question is still the same, how to create a basic C++ dll for smartphone from Visual Stuidio 2005 ?

Thanks

lmussier at 2007-9-9 > top of Msdn Tech,Smart Device Development,Smart Devices General...
# 6

Select the "Other Language/Visual C++/Smartdevice" and then template "Win32 Smart Device Project" in the New Project dialog. This presents a wizard that has a selection "Application Settings". It is there you can select "DLL" as the project type.

Dale

DLLarson at 2007-9-9 > top of Msdn Tech,Smart Device Development,Smart Devices General...
# 7
Perfect that's it.
Really thanks ;o)
lmussier at 2007-9-9 > top of Msdn Tech,Smart Device Development,Smart Devices General...