|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How do I add a c++ library to my vb.net project?Okay, this is a pretty basic question. I've created a static library
using c++. Now, I've started a vb.net project. How do I reference the functions in the static library? I'm using Visual Studio 2005. I.E., how do I add the library to the project, and call it's functions? Any help would be greatly appreciated!!!! Thank you in advance. "Bmack500" <brett.m***@gmail.com> schrieb: You do not need to add a reference to your VB project if you are talking > Okay, this is a pretty basic question. I've created a static library > using c++. Now, I've started a vb.net project. How do I reference the > functions in the static library? I'm using Visual Studio 2005. > > I.E., how do I add the library to the project, and call it's functions? about a standard C++ DLL which exports functions. Check out the 'Declare' statement and the 'DllImportAttribute' class, both can be used to access functions exported by a native DLL. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://dotnet.mvps.org/dotnet/faqs/> It's a library file (*.lib). When I try to compile it as a .dll, it
gives me all kinds of linker errors. Not sure how to compile it as a dll! Here are the errors: Error 4 error LNK2019: unresolved external symbol __imp__ldap_unbind referenced in function "int __cdecl GetChangeNotifications(wchar_t *)" (?GetChangeNotifications@@YAHPA_W@Z) adMonlib.obj I've added the path to the dll's (mfc) where these are located to no avail. Herfried K. Wagner [MVP] wrote: Show quoteHide quote > "Bmack500" <brett.m***@gmail.com> schrieb: > > Okay, this is a pretty basic question. I've created a static library > > using c++. Now, I've started a vb.net project. How do I reference the > > functions in the static library? I'm using Visual Studio 2005. > > > > I.E., how do I add the library to the project, and call it's functions? > > You do not need to add a reference to your VB project if you are talking > about a standard C++ DLL which exports functions. Check out the 'Declare' > statement and the 'DllImportAttribute' class, both can be used to access > functions exported by a native DLL. > > -- > M S Herfried K. Wagner > M V P <URL:http://dotnet.mvps.org/> > V B <URL:http://dotnet.mvps.org/dotnet/faqs/> Did you ever get an answer to this? I need to do exactly the same thing and
have not figured out how to do it yet. I have a static library (.lib) and need to use functions within it, either by some syntax for including and addressing the .lib or by figuring out how to compile the .lib to a .dll and add a reference. Any assistance hugely appreciated. This is a hot topic for me. -- Show quoteHide quote....many a beautiful theory was killed by an ugly fact. --Thomas Huxley "Bmack500" wrote: > It's a library file (*.lib). When I try to compile it as a .dll, it > gives me all kinds of linker errors. Not sure how to compile it as a > dll! > > Here are the errors: > > Error 4 error LNK2019: unresolved external symbol __imp__ldap_unbind > referenced in function "int __cdecl GetChangeNotifications(wchar_t *)" > (?GetChangeNotifications@@YAHPA_W@Z) adMonlib.obj > > I've added the path to the dll's (mfc) where these are located to no > avail. > > > > Herfried K. Wagner [MVP] wrote: > > "Bmack500" <brett.m***@gmail.com> schrieb: > > > Okay, this is a pretty basic question. I've created a static library > > > using c++. Now, I've started a vb.net project. How do I reference the > > > functions in the static library? I'm using Visual Studio 2005. > > > > > > I.E., how do I add the library to the project, and call it's functions? > > > > You do not need to add a reference to your VB project if you are talking > > about a standard C++ DLL which exports functions. Check out the 'Declare' > > statement and the 'DllImportAttribute' class, both can be used to access > > functions exported by a native DLL. > > > > -- > > M S Herfried K. Wagner > > M V P <URL:http://dotnet.mvps.org/> > > V B <URL:http://dotnet.mvps.org/dotnet/faqs/> > > Nope, I just found a way around it. I was also told that it couldn't be
done, but the documentation seems it indicate that not only can it be done, but that it's routine. So I haven't investigated a solution since then. RickW_inHouston wrote: Show quoteHide quote > Did you ever get an answer to this? I need to do exactly the same thing and > have not figured out how to do it yet. I have a static library (.lib) and > need to use functions within it, either by some syntax for including and > addressing the .lib or by figuring out how to compile the .lib to a .dll and > add a reference. > > Any assistance hugely appreciated. This is a hot topic for me. > > > -- > ...many a beautiful theory was killed by an ugly fact. --Thomas Huxley > > > "Bmack500" wrote: > > > It's a library file (*.lib). When I try to compile it as a .dll, it > > gives me all kinds of linker errors. Not sure how to compile it as a > > dll! > > > > Here are the errors: > > > > Error 4 error LNK2019: unresolved external symbol __imp__ldap_unbind > > referenced in function "int __cdecl GetChangeNotifications(wchar_t *)" > > (?GetChangeNotifications@@YAHPA_W@Z) adMonlib.obj > > > > I've added the path to the dll's (mfc) where these are located to no > > avail. > > > > > > > > Herfried K. Wagner [MVP] wrote: > > > "Bmack500" <brett.m***@gmail.com> schrieb: > > > > Okay, this is a pretty basic question. I've created a static library > > > > using c++. Now, I've started a vb.net project. How do I reference the > > > > functions in the static library? I'm using Visual Studio 2005. > > > > > > > > I.E., how do I add the library to the project, and call it's functions? > > > > > > You do not need to add a reference to your VB project if you are talking > > > about a standard C++ DLL which exports functions. Check out the 'Declare' > > > statement and the 'DllImportAttribute' class, both can be used to access > > > functions exported by a native DLL. > > > > > > -- > > > M S Herfried K. Wagner > > > M V P <URL:http://dotnet.mvps.org/> > > > V B <URL:http://dotnet.mvps.org/dotnet/faqs/> > > > > |
|||||||||||||||||||||||