|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Exporting a function from VB.net DLLI 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 This is a VB group. VB.Net is a very different
thing, despite the confusing similarity of names. For VB.Net you can try the groups below, or any other group with "dotnet" or "vsnet" in the name: microsoft.public.dotnet.general microsoft.public.dotnet.languages.vb Show quoteHide quote > 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 On 2009-07-02, Bhavik <bhavik.pa***@gmail.com> wrote:
Show quoteHide quote > Hello, You can't export a function from a .NET dll. This is not supported.> > 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 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: http://tom-shelton.net/?p=40 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 -- Tom Shelton On 2009-07-02, Tom Shelton <tom_shel***@comcastXXXXXXX.net> wrote:
Show quoteHide quote > On 2009-07-02, Bhavik <bhavik.pa***@gmail.com> wrote: Crap... Sorry - I just realized this is the VB.CLASSIC group!>> 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: > > http://tom-shelton.net/?p=40 > > 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 > To the op. You should ask your VB.NET questions over on microsoft.public.dotnet.languages.vb -- Tom Shelton
Removing too many hyphens
Printing contents of a picture box Package & Deployment Remote-Desktop "client/ server" Re: ADO: Deleting a table after it is loaded into Recordset Date and regional settings problem Type comparison Problem with DIR function..... VB 6 procedure to SQL SP Need help retrieving a udp response after sending a udp command |
|||||||||||||||||||||||