468,170 Members | 1,905 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,170 developers. It's quick & easy.

Description of unmanaged exposed dll functions

I can not seem to find the thread that described how to expose the functions
of functions that are usable in an unmanaged dll? any help would be great

regards,
Jay
Nov 15 '05 #1
1 1938
I use dumpbin.exe -exports "C:\Computer\Programs\MyUnmanaged.dll"

If it is a C++ DLL, you may have to access the functions by ordinal. If it
is C, you should be able to access them by name.
You'll have to use P/Invoke (Platform Invoke) to call the functions. Once
you declare the function as shown below,
you can call it as you would any other C# method. If the unmanaged functions
have tricky parameters, you'll have to
study up a bit on P/Invoke to figure out which .NET types to substitute for
the unmanaged parameter types.

//example for C++ name mangling -- use ordinal as shown with # prefix
[DllImport("MyUnmanaged.dll", EntryPoint="#46")]
private static extern void MyExportedMethodOrdinal46(int k);

//example for unmangled names (C style)
[DllImport("MyUnmanaged.dll", EntryPoint="SetSpecialTreatment")]
private static extern void SetSpecialTreatment(int action);

"jayderk" <ja*****@hotmail.com> wrote in message
news:up**************@TK2MSFTNGP09.phx.gbl...
I can not seem to find the thread that described how to expose the functions of functions that are usable in an unmanaged dll? any help would be great

regards,
Jay

Nov 15 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by dydrmr | last post: by
8 posts views Thread by Marty | last post: by
3 posts views Thread by Tommy Svensson \(InfoGrafix\) | last post: by
reply views Thread by kamranasdasdas | last post: by
reply views Thread by gcreed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.