473,408 Members | 2,813 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

problem in using exported function in a native DLL

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());
}
}
}
Nov 15 '05 #1
1 1870
Basicly, I have one exported function in the DLL:
whenever i execute this exe to Pocket pc it returns
MissingMethod Exception.


It's probably exported with a decorated (mangled) name. Try running

dumpbin /exports NativeFunction.dll

and see what the real exported name is.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/
Please reply only to the newsgroup.
Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Randy Roman | last post by:
Hello to all. I have a nagging problem concerning where to call CoUninitialize() COM function. I realize that this may be more of a C++/COM question rather than a Java question, but I just thought...
2
by: Pawan Aggarwal | last post by:
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...
1
by: Richard A. Lowe | last post by:
I have a non-COM, non-.NET DLL, apparently written in C++ but for which there is no source available (so I am told). I have tried the DumpBin utility and Dependancy Walker to examine the exported...
2
by: Jacob Cohen | last post by:
Under VC7.1, I am trying to wrap a native-C++ DLL that contains C++ objects in a Managed-C++ class library for use in a C# project. I created and compiled the native DLL under VC7.1 as a Win32...
8
by: Mas L via DotNetMonster.com | last post by:
Hi, I have a c++ source code which I can compile to be a DLL (in VS.NET 2003). And I need to use it in a C# program. After I compiled/build the C++ code to a DLL, I add it as a Reference in my...
0
by: Lokkju | last post by:
I am pretty much lost here - I am trying to create a managed c++ wrapper for this dll, so that I can use it from c#/vb.net, however, it does not conform to any standard style of coding I have seen....
2
by: Anshul | last post by:
I have a typical scenario to work with and seeking help for the same. The scenario is. 1) I have to write some code in Managed C++ and C# code. 2) Managed C++ will interact with Native windows...
3
by: Petded | last post by:
I have seen some articles on using unmanged dll's in managed c++, but they all see to require knwing the paramters and structures of the the dll functions to be called. I have this freeware dll...
2
by: chandramohanp | last post by:
I am having problem to delete a Managed C++ DLL that was used in a pure C# DLL even in the following scenario. 1. Launch the application. This applicatio has its own default applicaiton...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.