473,320 Members | 1,945 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,320 software developers and data experts.

Dll - Export Function - EntryPointNotFoundException

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.EntryPointNotFoundException. 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 3484
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.EntryPointNotFoundException. 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.public.dotnet.languages.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.public.dotnet.languages.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.comwrote:
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.public.dotnet.languages.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.EntryPointNotFoundException. 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.comwrote:
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, AesCryptoServiceProvider 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
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...
205
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
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...
2
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,...
1
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...
12
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:...
0
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...
5
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...
4
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.