Dawn,
Here is a recent post in the classic VB group. The guy answering, Tom
Shelton, is a qualified individual with respect to both classic vb and
vb.net.
> Hello,
I need to develop a DLL in VB.net 2008, which exports a function.
This function can be called from another C++ DLL or Win32 application
(which is not necessarily developed in VB.net).
I have created a new Class Library project in VB.net, and added
following code in it:
Public Class Class1
Public Function Myfunc(ByVal num As Integer) As Boolean
// do some processing in num
// return a Boolean flag value based on result
End Function
End Class
Now I created a new WIn32 application in C++, and tried to call the
"Myfunc" from this DLL, but it gives error code 127 (Procedure does
not exist). So, I guess the "Myfunc" is not exported from my DLL.
Can anyone please tell me how to export a function from VB.net DLL,
and if possible, how to call it from another C++ application?
Please help me. Thanks in advance for help.
/BP
You can't export a function from a .NET dll. This is not supported.
If you need to expose your .NET objects to non-.NET languages, the your best
bet is to expose your classes via COM - there are lots of examples of this
on
the web and in the documentation.
If you actually need it to be a native dll function then, you can use
C++/CLI
to create a native wrapper for those situations - I have an example of this
on
my blog:
(There was a link here but it was dead. I went to Tom's site and this is
the closest I could
find to what you are talking about
http://tom-shelton.net/index.php/2008/12/11/creating-a-managed-wrapper-for-a-lib-file/
)
The above creates a standard dll wrapper around a C# class library. The
process is identical when using VB.NET (with the caveat that VB.NET handles
namespaces a bit differently).
HTH
----- Original Message -----
From: <[email protected]>
To: "RBASE-L Mailing List" <[email protected]>
Sent: Wednesday, August 25, 2010 3:58 PM
Subject: [RBASE-L] - .NET DLL
I think I remember something on the list previously about using DLCALL
with .NET DLLs - and that it doesn't work because the functions are not
exported. My memory's not great, and I haven't tried it yet, so I could
have that completely wrong. Is that true? If so, what options are there
in a situation where a .NET DLL needs to be integrated with an existing
RBase app?
Thanks for any assistance.
Dawn
DISCLAIMER: This electronic message together with any attachments is
confidential. If you are not the intended recipient, do not copy, disclose
or
use the contents in any way. Please also advise us by return e-mail that
you
have received the message and then please destroy. Evergreen Packaging is
not
responsible for any changes made to this message and / or any attachments
after
sending by Evergreen Packaging. We use virus scanning software but exclude
all
liability for viruses or anything similar in this email or any attachment.