I'm having trouble with calling an exported function in a
native DLL compiled with eMbedded Visual C++ using C#.
Basicly, I have one exported function in the DLL:
whenever i execute this exe to Pocket pc it returns
MissingMethod Exception.
Code for DLL is
NativeFunctions .h
#ifdef NATIVEDLL_EXPOR TS
#define DLLEXPORT _declspec(dllex port)
#else
#define DLLEXPORT _declspec(dllim port)
#endif
#ifdef __cplusplus
extern "C" {
#endif
DLLEXPORT int function();
#ifdef __cplusplus
}//end extern "C"
#endif
NativeFunction. cpp
#include "stdafx.h"
#include "NativeFunction s.h"
int function()
{
return 25;
}
and a C# client of the DLL:
using System;
using System.Data;
using System.Runtime. InteropServices ;
namespace Client
{
class Class1
{
[ DllImport("Nati veFunction.dll" , EntryPoint="fun ction") ]
public static extern int function();
static void Main(string[] args)
{
int x = function();
MessageBox.Show (x.toString());
}
}
}
native DLL compiled with eMbedded Visual C++ using C#.
Basicly, I have one exported function in the DLL:
whenever i execute this exe to Pocket pc it returns
MissingMethod Exception.
Code for DLL is
NativeFunctions .h
#ifdef NATIVEDLL_EXPOR TS
#define DLLEXPORT _declspec(dllex port)
#else
#define DLLEXPORT _declspec(dllim port)
#endif
#ifdef __cplusplus
extern "C" {
#endif
DLLEXPORT int function();
#ifdef __cplusplus
}//end extern "C"
#endif
NativeFunction. cpp
#include "stdafx.h"
#include "NativeFunction s.h"
int function()
{
return 25;
}
and a C# client of the DLL:
using System;
using System.Data;
using System.Runtime. InteropServices ;
namespace Client
{
class Class1
{
[ DllImport("Nati veFunction.dll" , EntryPoint="fun ction") ]
public static extern int function();
static void Main(string[] args)
{
int x = function();
MessageBox.Show (x.toString());
}
}
}
Comment