473,657 Members | 2,686 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_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());
}
}
}
Nov 15 '05 #1
1 1895
Basicly, I have one exported function in the DLL:
whenever i execute this exe to Pocket pc it returns
MissingMetho d 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
3660
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 that somebody with JNI/COM experience may be able to help me out. I already posted a similar question in C++ groups but unluckily I haven't received a reply. Here goes... I have a JNI DLL that is statically linked to an MFC DLL. The MFC DLL...
2
3480
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 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.
1
2788
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 functions so that I can P/Invoke them from C# but I only ever see the names of the functions, never the full signature. I realize I might not be able to get the actual as-in-code definition, but there must be SOME way to infer this, isn't there?...
2
7571
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 DLL C++ (unmanaged) project. I found the decorated names of the symbols I wanted to export and created a .def file, so that it generated an import library. I took this import library and had my Managed-C++ class library link against it. The...
8
3610
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 C# program. When I look at the reference and I double click to view it in the objec browser , I see only structs , without their members. And I don't see methods.
0
3931
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. It is almost like it is trying to implement it's own COM interfaces... below is the header, and a link to the dll+code: Zip file with header, example, and DLL:...
2
1481
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 service. Detailed Information C++ Dll When the native windows service start, it calls its own callback Init ( ) method in our C++ dll (coz these methods are exported from this dll).
3
1118
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 that provides socket functions, but there is no info on its internal structure so i can declare its use correctly. Is there some way to interogate the dll and get this information thanks for any help
2
3194
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 domain. 2. Create a new Application Domain. 3. Load the Pure C# DLL in the new applicaiton domain. This C# DLL uses managed C++ DLL. 4. Create a Proxy object using CreateInstanceAndUnwrap for the wrapper
0
8407
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8319
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8739
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8612
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7347
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5638
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4329
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1969
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1732
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.