473,976 Members | 21,699 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to access a c++ library from a 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?
Or, do I need to declare if as a .dll? When I do that it won't compile,
giving lnk_2019 errors. I'm using the MFC classes in my c++ app.
Any help would be greatly appreciated!!!!
Thank you in advance.

Aug 28 '06 #1
3 3858
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.
You don't.
I.E., how do I add the library to the project, and call it's functions?
You can't.
Or, do I need to declare if as a .dll? When I do that it won't compile,
giving lnk_2019 errors. I'm using the MFC classes in my c++ app.
You can either:
a) create a managed class library of your C++ functions.
b) create an unmanaged dll with exported functions. they can only be C style
functions though.
c) create a COM object and consume that in your VB app.

using a static C++ lib in a vb app is not possible afaik.

--

Kind regards,
Bruno van Dooren
br************* *********@hotma il.com
Remove only "_nos_pam"
Aug 28 '06 #2
How can I accomplish "a"?

The code is here:

<http://msdn.microsoft. com/library/default.asp?url =/library/en-us/ad/ad/example_code_fo r_receiving_cha nge_notificatio ns.asp>

Bruno van Dooren [MVP VC++] wrote:
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.

You don't.
I.E., how do I add the library to the project, and call it's functions?

You can't.
Or, do I need to declare if as a .dll? When I do that it won't compile,
giving lnk_2019 errors. I'm using the MFC classes in my c++ app.

You can either:
a) create a managed class library of your C++ functions.
b) create an unmanaged dll with exported functions. they can only be C style
functions though.
c) create a COM object and consume that in your VB app.

using a static C++ lib in a vb app is not possible afaik.

--

Kind regards,
Bruno van Dooren
br************* *********@hotma il.com
Remove only "_nos_pam"
Aug 28 '06 #3
How can I accomplish "a"?

Start a new C++ CLR class library project.
make sure that /clr is used in your project settings so that you can compile
mixed mode code.

Then you create a managed class, in which you call your unmanaged functions.

For examples and tutorials on mixed mode code, you can go to
www.codeproject.com
and search for interop and C++/CLI. google will also turn up lots of links.

--

Kind regards,
Bruno van Dooren
br************* *********@hotma il.com
Remove only "_nos_pam"
Aug 29 '06 #4

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

Similar topics

1
1569
by: RichGolebiowski | last post by:
I have a class library (clsTestLib) that was created in VB.Net that I would like to use in Access 2000. I created a typelib for the class using regasm.exe. I am able to refernce (add a reference) the dll using the generated typelib. In Access, when I run the Access application and declare a new instance of the class as follows Dim MyTest As clsTestLib.Class1 Set MyTest = New clsTestLib.Class1 I get an error Run-time message that says...
1
280
by: juchytil | last post by:
We have written a C# class library project called ESUtilsCS.cs and its dll was imported as a component into a COM+ Application on a Windows 2000 server. (The code for the class library cann be found at the end of this post.) We successfully access the component from a jscript ASP page (code below ) How can I access the same component from C# Asp.NET? Joe
5
2964
by: Raterus | last post by:
I'm just throwing this error out for my sanity, I've seen posts about this, but never solutions. I'm using VS.NET 2003, Framework 1.1, and I'm getting a random error about every 1 out of 10 times I try to start to run/debug a project (through Visual Studio) Server Error in '/Intranet' Application. -------------------------------------------------------------------------------- Compilation Error Description: An error occurred during...
7
4788
by: Martin Strojek | last post by:
Hi, I have the following problem with developing some web site. I use Visual Studio 2003 to build a website. I tried Windows 2003 Server and switched now back to Windows XP with PWS but the error occurs in both installations. When I do a compile/build of my app and go to the browser and hit reload there comes an error:
10
1949
by: bradtm | last post by:
So I have this hierarchy: + Solution | |--- + Class Library Project | | | |--- LogError.vb | |--- + ASP .NET Web Application |
3
2556
by: Mark | last post by:
I'm getting the following error when I add Access as a reference to my project: A reference to 'Microsoft Access 10.0 Object Library' could not be added. Converting the type library to a .NET assembly failed. A dependent type library 'OWC10' could not be converted to a .NET assembly. A depedent type library 'ADODB' could not be converted to a .NET assembly. Item has already been added. Key in dictionary:...
5
2703
by: Lyle Fairfield | last post by:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/callnetfrcom.asp The Joy of Interoperability Sometimes a revolution in programming forces you to abandon all that's come before. To take an extreme example, suppose you have been writing Visual Basic applications for years now. If you're like many developers, you will have built up a substantial inventory of code in that time. And if you've been following...
34
2648
by: Mathieu Trentesaux | last post by:
Hello I downloaded Office 2007 for this reason : It seems, once again, that it is impossible to save any modification done in a VBA library, from the main project in Access. The save button remains desperatly grayed. It also seems impossible to open the library in another Access instance
0
6258
by: Anonieko | last post by:
A lot of times, web hostings for ASPNET 2.0 will offer only MS Access DB for database for basic plan, a question often asked is how can I use the membership services, role, web parts services, etc for this MS Access db. Well, microsoft offers a download sample. Instructions are below. HOW TO USE MS ACCESS DB FOR ASPNET APPLICATION SERVICES ( membership, profile, roles, etc providers)
3
2923
by: SAL | last post by:
Hi, I have Microsoft Enterprise Library 2005 installed on my local system. I'm developing in C# using Visual Studio 2003 IDE with framework 1.1. I am automating a process that will use a DLL assembly I am developing. I am going to use the data Access Application Block for data access in my DLL assembly, and a Windows Service will execute the DLL on a set schedule. To make this happen I will add the Common, Configuration, and Data...
0
11818
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11408
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
11571
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10908
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
10083
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7604
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6415
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
5153
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 we have to send another system
3
3761
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.