P
Pawan Aggarwal
I'm having trouble with calling an exported function in a
native DLL compiled with eMbedded Visual C++ in C#
application in PocketPC 2002 OS.
Problem Description follows:
I have one exported function in the DLL:
I am making an application for pocket Pc in C# using this
DLL Function.
whenever I execute this exe in Pocket pc it returns
MissingMethod Exception.
Following is the listing of NativeFunctions.h,
NativeFunctions.cpp , NativeApp.cs files
Code listing for DLL is follows:
/***********************/
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;
}
******************/
C# client of the DLL follows:
/*********************************
NativeApp.cs
*****************/
using System;
using System.Data;
using System.Runtime.InteropServices;
namespace Client
{
class Class1
{
[ DllImport("NativeFunctions.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++ in C#
application in PocketPC 2002 OS.
Problem Description follows:
I have one exported function in the DLL:
I am making an application for pocket Pc in C# using this
DLL Function.
whenever I execute this exe in Pocket pc it returns
MissingMethod Exception.
Following is the listing of NativeFunctions.h,
NativeFunctions.cpp , NativeApp.cs files
Code listing for DLL is follows:
/***********************/
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;
}
******************/
C# client of the DLL follows:
/*********************************
NativeApp.cs
*****************/
using System;
using System.Data;
using System.Runtime.InteropServices;
namespace Client
{
class Class1
{
[ DllImport("NativeFunctions.dll", EntryPoint="function") ]
public static extern int function();
static void Main(string[] args)
{
int x = function();
MessageBox.Show(x.toString());
}
}
}
/*****************************************/