HighTechTalks DotNet Forums  

Help Calling A Function from a 32-bit non-.NET DLL

VB.net microsoft.public.dotnet.languages.vb


Discuss Help Calling A Function from a 32-bit non-.NET DLL in the VB.net forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #11  
Old   
dave_wurtz@msn.com
 
Posts: n/a

Default Re: Help Calling A Function from a 32-bit non-.NET DLL - 06-30-2010 , 02:33 PM






On Jun 18, 2:22*pm, Tom Shelton <tom_shel... (AT) comcast (DOT) invalid> wrote:
Quote:
DaveWurtzsubmitted this idea :





On Jun 18, 8:47*am, Tom Shelton <tom_shel... (AT) comcast (DOT) invalid> wrote:
DaveWurtzformulated the question :

On Jun 7, 5:16*pm, "Herfried K. Wagner [MVP]" <hirf-spam-me-
h... (AT) gmx (DOT) at> wrote:
Am 08.06.2010 00:05, schriebDaveWurtz:
In my VB.NET application, I'm trying to call a function from a 32-bit,
non-.NET dll file and I'm having problems. *I believe I have the
correct signature for the dll with:
System.Runtime.InteropServices.DllImportAttribute( "asdHTMLCompare.dll")
*>[...] When I run this, I get the error:
An exception of type 'System.EntryPointNotFoundException' occurred in
ProductVision.Windows.Forms.dll but was not handled in user code.
Additional information: Unable to find an entry point named
'BuildCompositeFile' in DLL 'asdHTMLCompare.dll'.
Maybe the function has a different name. *You may want to use Dependency
Walker (<URL:http://www.dependencywalker.com/>) to examine the function
the DLL exports.

--
* M S * Herfried K. Wagner
M V P *<URL:http://dotnet.mvps.org/
* V B * <URL:http://dotnet.mvps.org/dotnet/faqs/
Thanks for the reply.

As suggested, I downloaded the Dependency Walker program and opened
the DLL. *In looking at the function I want to call and selecting
"Undecorate C++ Functions", this is what it shows:
int BuildCompositeFile(char *,char *,char *,char *,char *,char *,int)
Do I have the correct signature defined?
Thanks.
Dave

If the dll is exposing a decorated name, then you must alias the vb
declare to the decorated name....

--
Tom Shelton- Hide quoted text -

- Show quoted text -

I don't understand what you are saying. *Can you expand on this and/or
show an example?

By default a dll compiled in C++ will mangle the names - this is to
allow overriding of functions. * So, your function BuildCompositeFile
maybe exported as something like ?BuildCompositFile@@YXZ. *That isn't
probably the actual name - I the way names are mangaled or decorated
has *alot to do with the compiler, and the types being passed. *But the
point is, the entery point in the dll is probably NOT
BuildCompositeFile.

You can use dumpbin /exports on your dll to see the actual name table. *
So, say the name is as above, then you would need to add an alias to
your VB declare:

Declare Ansi Function BuildCompositFile Lib "asdHtmlCompare.dll" Alias
"?BuildCompositFile@@YXZ" (.....)

HTH

--
Tom Shelton- Hide quoted text -

- Show quoted text -
Thank you. This worked perfect!
Dave

Reply With Quote
  #12  
Old   
dave_wurtz@msn.com
 
Posts: n/a

Default Re: Help Calling A Function from a 32-bit non-.NET DLL - 06-30-2010 , 02:33 PM






On Jun 18, 2:26*pm, "Herfried K. Wagner [MVP]" <hirf-spam-me-
h... (AT) gmx (DOT) at> wrote:
Quote:
Am 18.06.2010 20:03, schriebDaveWurtz:

If the dll is exposing a decorated name, then you must alias the vb
declare to the decorated name....

I don't understand what you are saying. *Can you expand on this and/or
show an example?

Use the name you see prior to choosing to undecorate the function.

--
* M S * Herfried K. Wagner
M V P *<URL:http://dotnet.mvps.org/
* V B * <URL:http://dotnet.mvps.org/dotnet/faqs/
Thank you. This worked perfect!
Dave

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.