473,730 Members | 2,044 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dll - Export Function - EntryPointNotFo undException

Hi All,

Sorry about dropping thish on M.P.D.L.CSharp. There is no M.P.D.L.VC.
So I hope someone has come across the issue...

How does one export a function (not a class) in a managed Dll?

I'm catching a System.EntryPoi ntNotFoundExcep tion. dumpbin confirms
that the Dll is not exporting the function.

Does not work:
* declaring method as public: error C2059: syntax error : 'public'
* __declspec( dllexport ): incompatible with /clr and /clr:pur
* .def file: fatal link error LNK1310: Exports not supported for pure
MSIL image

Thanks,
Jeff

////////////////////////
// Test Header
bool Test( array<byte>^ );

////////////////////////
// Test Implementation
bool Test( array<byte>^ a ) {...}
Aug 5 '08 #1
6 3512
On Aug 5, 3:59 pm, Jeffrey Walton <noloa...@gmail .comwrote:
Hi All,

Sorry about dropping thish on M.P.D.L.CSharp. There is no M.P.D.L.VC.
So I hope someone has come across the issue...

How does one export a function (not a class) in a managed Dll?
You cannot do it AFAIK
A managed dll export only types.
You can create a wrap and then you get a CCW (COM Callable Wrapper).
but even that is a COM DLL, not a win32 one.
The only solution I see is for you to create your .NET dll, export it
as CCW and then create a native dll that instantiate the COM and allow
a call to the method you need as a function

I'm catching a System.EntryPoi ntNotFoundExcep tion. dumpbin confirms
that the Dll is not exporting the function.

Does not work:
* declaring method as public: error C2059: syntax error : 'public'
* __declspec( dllexport ): incompatible with /clr and /clr:pur
* .def file: fatal link error LNK1310: Exports not supported for pure
MSIL image

Thanks,
Jeff

////////////////////////
// Test Header
bool Test( array<byte>^ );

////////////////////////
// Test Implementation
bool Test( array<byte>^ a ) {...}
Aug 5 '08 #2
On Aug 5, 11:59*pm, Jeffrey Walton <noloa...@gmail .comwrote:
Hi All,

Sorry about dropping thish on M.P.D.L.CSharp. There is no M.P.D.L.VC.
There is, microsoft.publi c.dotnet.langua ges.vc:

http://groups.google.com/group/micro...ages.vc/topics
How does one export a function (not a class) in a managed Dll?
You can't.
Aug 6 '08 #3
Hi Pavel,
There is, microsoft.publi c.dotnet.langua ges.vc:
Thanks. When I looked yesterday, Google did not return it. Odd???
You can't.
Is that a 'you can't' because Microsoft tools do not do it?

Jeff

On Aug 6, 6:38*am, Pavel Minaev <int...@gmail.c omwrote:
On Aug 5, 11:59*pm, Jeffrey Walton <noloa...@gmail .comwrote:
Hi All,
Sorry about dropping thish on M.P.D.L.CSharp. There is no M.P.D.L.VC.

There is, microsoft.publi c.dotnet.langua ges.vc:

http://groups.google.com/group/micro...languages.vc/t...
How does one export a function (not a class) in a managed Dll?

You can't.
Aug 6 '08 #4
Hi Ignacio,
You cannot do it AFAIK
Is that a 'you cannot' because Microsoft tools don't do it?

I asked Pavel the same. The reason I ask is that I have an
experimental linker. While developing it, I picked up a lot of PE
format knowledge. So it may be a question of finding the right tool
for the job. Naively, I'm going to say that adding a Export directory
to the PE and a thunk in the .text section is quite doable.

Jeff

On Aug 5, 4:43*pm, "Ignacio Machin ( .NET/ C# MVP )"
<ignacio.mac... @gmail.comwrote :
On Aug 5, 3:59 pm, Jeffrey Walton <noloa...@gmail .comwrote:
Hi All,
Sorry about dropping thish on M.P.D.L.CSharp. There is no M.P.D.L.VC.
So I hope someone has come across the issue...
How does one export a function (not a class) in a managed Dll?

You cannot do it AFAIK
A managed dll export only types.
You can create a wrap and then you get a CCW (COM Callable Wrapper).
but even that is a COM DLL, not a win32 one.
The only solution I see is for you to create your .NET dll, export it
as CCW and then create a native dll that instantiate the COM and allow
a call to the method you need as a function
I'm catching a System.EntryPoi ntNotFoundExcep tion. dumpbin confirms
that the Dll is not exporting the function.
Does not work:
* declaring method as public: error C2059: syntax error : 'public'
* __declspec( dllexport ): incompatible with /clr and /clr:pur
* .def file: fatal link error LNK1310: Exports not supported for pure
MSIL image
Thanks,
Jeff
////////////////////////
// Test Header
bool Test( array<byte>^ );
////////////////////////
// Test Implementation
bool Test( array<byte>^ a ) {...}- Hide quoted text -

- Show quoted text -
Aug 6 '08 #5
On Aug 6, 6:26*pm, Jeffrey Walton <noloa...@gmail .comwrote:
Hi Ignacio,
You cannot do it AFAIK

Is that a 'you cannot' because Microsoft tools don't do it?

I asked Pavel the same. The reason I ask is that I have an
experimental linker. While developing it, I picked up a lot of PE
format knowledge. So it may be a question of finding the right tool
for the job. Naively, I'm going to say that adding a Export directory
to the PE and a thunk in the .text section is quite doable.
You can probably do it, but that wouldn't be a pure managed assembly
anymore (similarly to what C++/CLR produces). At any rate, it wouldn't
be any different from just having a separate unmanaged assembly
redirecting calls to a managed one.
Aug 11 '08 #6
Hi Pavel,

On Aug 11, 5:22*am, Pavel Minaev <int...@gmail.c omwrote:
On Aug 6, 6:26*pm, Jeffrey Walton <noloa...@gmail .comwrote:
{SNIP]
The reason I ask is that I have an
experimental linker. While developing it, I picked up a lot of PE
format knowledge. So it may be a question of finding the right tool
for the job. Naively, I'm going to say that adding a Export directory
to the PE and a thunk in the .text section is quite doable.

You can probably do it, but that wouldn't be a pure managed assembly
anymore (similarly to what C++/CLR produces). At any rate, it wouldn't
be any different from just having a separate unmanaged assembly
redirecting calls to a managed one.
I think in the end that though possible, I believe it will create more
problems then it solves. My need was to keep a consistent interface
(from an unmanaged Dll) when wrapping an AES crpyo engine. When I ran
the managed AES benchmarks, AesCryptoServic eProvider performed like a
turd.

Jeff
Aug 11 '08 #7

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

Similar topics

0
1901
by: Shawn Mehaffie | last post by:
I have the following class that I've wirtten to take a Dataset and automatically export it to either XML, ASCII or Tab delimited file. The reason I wrote it they way I did was that I don't want to have o create a temporary file on the web server everytime someone want to run and export. When I call the ExportToBrowser function the user gets the standard open/save file dialog box. If the user chooses to save the file the program works...
205
10670
by: Jeremy Siek | last post by:
CALL FOR PAPERS/PARTICIPATION C++, Boost, and the Future of C++ Libraries Workshop at OOPSLA October 24-28, 2004 Vancouver, British Columbia, Canada http://tinyurl.com/4n5pf Submissions
5
11035
by: Tim Eliot | last post by:
Just wondering if anyone has hit the following issue and how you might have sorted it out. I am using the command: DoCmd.TransferText acExportMerge, , stDataSource, stFileName, True after setting stDataSource and stFileName to the desired values. Most of the time it works, but occasionally, typically as code changes are being made to the module, the following message appears:
2
5301
by: Kurt Ng | last post by:
Hi, y'all. Can anyone help me on this problem? I'm working with a third-party C dll, and I'm having trouble importing into C# the dll's methods that return one of the dll's defined types, which are all defined as opaque pointers. What I tried to do is use IntPtr for the opaque pointer return type, but there seems to be a resulting signature problem.
1
2092
by: Thomas Johansen | last post by:
Hi I have an GetObject() function in my "old" unmangaed C++ compiled DLL. I need to call some function in this dll, so I use DllImport in my C# application. This is how I do it: (This code works)
12
1719
by: glutz7878 | last post by:
I have no trouble passing __delegate ptrs to native C functions in DLLs, however when attempting to pass the __delegate ptr to a native C++ function in a DLL I get the following runtime exception: An unhandled exception of type 'System.EntryPointNotFoundException'. This is confusing b/c if the entry point was not found, I would think I'd get an unresolved symbol error during linking. Furthermore, I can successfully pass void, int *, and...
0
1512
by: Shawn Mehaffie | last post by:
I have the following class that I've wirtten to take a Dataset and automatically export it to either XML, ASCII or Tab delimited file. The reason I wrote it they way I did was that I don't want to have o create a temporary file on the web server everytime someone want to run and export. When I call the ExportToBrowser function the user gets the standard open/save file dialog box. If the user chooses to save the file the program works fine,...
5
3439
by: JHNielson | last post by:
I have a somewhat simple question, but have been baffled by it for a while, and now I'm on a tight deadline - have to get it done within 24 hours. I am trying to export a set of files to my hard drive to then later be FTPd to a server. the file format should be "TITLE.yyyymmdd" where yymmdd is the date code for when the files are created. The files can't be .txt. But when I run the files as ".txt" the code runs just fine. when I...
4
2862
by: peetersb | last post by:
Hello, I'v a dll written in C/C++. I only have the header file. I dont know how to declare the external funtion: I've got a EntryPointNotFoundException, I think because of the wrong return type. The function in the header file return a enum. But I don't know how to declare it in my c# file. Can anybody help me?
0
8770
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
9440
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9299
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...
1
9227
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9174
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
8179
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
6029
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();...
1
3251
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2710
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.