473,473 Members | 1,947 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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.

Aug 28 '06 #1
4 3317
"Bmack500" <br********@gmail.comschrieb:
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/>

Aug 28 '06 #2
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" <br********@gmail.comschrieb:
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/>
Aug 30 '06 #3
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" <br********@gmail.comschrieb:
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/>

Oct 10 '06 #4
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:
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" <br********@gmail.comschrieb:
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/>
Nov 13 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: mccoyn | last post by:
I'm porting an old project to use .NET. When I try to link in a static library (.lib) that has a single managed class in it. I get the following errors: LINK : error LNK2020: unresolved token...
3
by: Rena | last post by:
Hi all, I have created a app. project and a library which will be used by the main project, however i do not know how to get into debug mode inside the library, although break point is set. is...
0
by: tony | last post by:
Hello! I have one solution file that consist of three project. One project that build the exe file called A One project that build a user control dll. In this user control we have a class...
0
by: tony | last post by:
Hello! I'm not sure if this is the right group to send my question in. I have one solution file that consist of three project. One project that build the exe file called A One project that...
6
by: =?Utf-8?B?WW9naSBXYXRjaGVy?= | last post by:
Hello, I am using Visual Studio-2003. I created a project to build my library. Since I am using third party libraries as well, I have specified those additional library dependencies in project...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.