How Do I Create an Entry Point for a DLL?

T

TC

I'm using VB.NET 2005. I need to create a DLL containing a function
F(). A VB.NET application will reference the DLL by using a Declare
statement.

Declare Function F Lib "Foo.dll" (ByVal Woo As String) As Double

When I write the DLL and test it, however, I get a runtime error.

Unable to find an entry point named 'F' in DLL 'Foo.dll'.

Judging from the error, it sounds like I need to create an "entry
point" in my DLL. Can anyone tell me how to do that?

Please note that I have no control over the code which calls my
function. That code uses a Declare statement.


-TC
 
T

Tom Shelton

TC said:
I'm using VB.NET 2005. I need to create a DLL containing a function
F(). A VB.NET application will reference the DLL by using a Declare
statement.

Declare Function F Lib "Foo.dll" (ByVal Woo As String) As Double

When I write the DLL and test it, however, I get a runtime error.

Unable to find an entry point named 'F' in DLL 'Foo.dll'.

Judging from the error, it sounds like I need to create an "entry
point" in my DLL. Can anyone tell me how to do that?

You can't. Declare statements are used to interact with native dll's
not managed dll's, in other words, managed applications do not
reference managed dll's via a declare statement. You will need to
write your dll in a language that supports this - like C++, PowerBasic,
etc.

Of course, there may be hacks to do this, just as there were for
VB.CLASSIC. I haven't looked, nor would I ever suggest anyone did
this. It is just not the way the tool your using works.
 
T

TC

Tom,

Thank you for the clear answer. I wrote the code in C++ and it works
well.

How can I know which languages support native DLLs and which support
managed DLLs? I used the Borland C++ compiler to generate my DLLs.
Could I have used Visual C++ .NET instead?

-TC
 
H

Herfried K. Wagner [MVP]

TC said:
How can I know which languages support native DLLs and which support
managed DLLs? I used the Borland C++ compiler to generate my DLLs.
Could I have used Visual C++ .NET instead?

Yes, you could have used Visual C++ .NET to do that.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top