Exporting entry points in a dll with classes

Joined
Jan 10, 2007
Messages
43,898
Location
In The Machine
When I don't have classes I do this to export my entry points:
//########################
//C++

extern"C"__declspec(dllexport) int__stdcall SumUp_unmgdCPP(int a, int b, int* c)
{
*** c[0]=4; c[1]=3; c[2]=2; c[3]=1;

//########################
//C#
[DllImport("NameOfDLL", CallingConvention = CallingConvention.StdCall)]
publicstaticexternint SumUp_unmgdCPP(int a, int b, int[] f); publicint SumUp(int a, int b, ref int[] f)
{
*** return SumUp_unmgdCPP(a, b, f);

How do you do it in a C++ dll-project with*classes? I did this:
class FMS
{
public:
*** extern"C"__declspec(dllexport) int__stdcall SumUp_unmgdCPP(int a, int b, int* c);

private:
*** float m_WheelSpeed; // 1
}
It complains about*the string "C" above being part of the declaration above. I don't think this is the way you do it when you have classes. Just paste the equivalent of what I'm doing in at the top in a dll-project with no classes but now*instead in a C++*dll-project with classes and I will be very thankful.​

/Lars​


More...

View All Our Microsoft Related Feeds
 
Back
Top