V
vijay
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_EXPORTS
#define DLLEXPORT _declspec(dllexport)
#else
#define DLLEXPORT _declspec(dllimport)
#endif
#ifdef __cplusplus
extern "C" {
#endif
DLLEXPORT int function();
#ifdef __cplusplus
}//end extern "C"
#endif
NativeFunction.cpp
#include "stdafx.h"
#include "NativeFunctions.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("NativeFunction.dll", EntryPoint="function") ]
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_EXPORTS
#define DLLEXPORT _declspec(dllexport)
#else
#define DLLEXPORT _declspec(dllimport)
#endif
#ifdef __cplusplus
extern "C" {
#endif
DLLEXPORT int function();
#ifdef __cplusplus
}//end extern "C"
#endif
NativeFunction.cpp
#include "stdafx.h"
#include "NativeFunctions.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("NativeFunction.dll", EntryPoint="function") ]
public static extern int function();
static void Main(string[] args)
{
int x = function();
MessageBox.Show(x.toString());
}
}
}