Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / August 2006

Tip: Looking for answers? Try searching our database.

How to access a c++ library from a vb.net project?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
brett.mack@gmail.com - 28 Aug 2006 18:40 GMT
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.
Bruno van Dooren [MVP VC++] - 28 Aug 2006 19:35 GMT
> 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.

Signature

Kind regards,
   Bruno van Dooren
   bruno_nos_pam_van_dooren@hotmail.com
   Remove only "_nos_pam"

brett.mack@gmail.com - 28 Aug 2006 19:42 GMT
How can I accomplish "a"?

The code is here:

<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ad/ad/example_c
ode_for_receiving_change_notifications.asp
>

> > 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
[quoted text clipped - 23 lines]
>     bruno_nos_pam_van_dooren@hotmail.com
>     Remove only "_nos_pam"
Bruno van Dooren [MVP VC++] - 29 Aug 2006 21:17 GMT
> 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.

Signature

Kind regards,
   Bruno van Dooren
   bruno_nos_pam_van_dooren@hotmail.com
   Remove only "_nos_pam"


Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.