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.
> 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"