If you do not have the *.lib that normally comes along with dlls then you can use LoadLibrary() to load the dll into memory, then GetProcAddress() to get a pointer to a function in the dll. See this for details.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
In Solution Explorer you can also use Add reference to add a dll to your project.
ddanbe
Senior Poster
3,829 posts since Oct 2008
Reputation Points: 2,070
Solved Threads: 661
In Solution Explorer you can also use Add reference to add a dll to your project.
Does that work with ordinary c++ programs? Or just CLI managed programs?
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
Does that work with ordinary c++ programs?
I think this will only work in Visual Studio...
ddanbe
Senior Poster
3,829 posts since Oct 2008
Reputation Points: 2,070
Solved Threads: 661
I think this will only work in Visual Studio...
Visual Studio is a compiler, not a language. What I am asking is do you have to create a CLI managed project to use that feature. I tried with a normal c++ program but could not add a reference that way. I don't normally write managed code.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
I tried to add the dll by reference->Add new Reference. then, it shows a pop up window called add reference. There I cant do nothing to add a dLL. Here I'm using visual c++ 2005.
wijitha
Yup, same here. Go back and re-read my previous post about LoadLibrary()
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
Visual Studio is a compiler, not a language.
Visual Studio is a development environment in wich you can have compilers for C++, C#,J++,Visual Basic and others. I use Visual C# most of the time and I can write managed and unmanaged code with it. But I like managed code. I can't count the hours I have wasted in C++ on figuring out why my handles and pointers where already in the "twilight zone" when they shouldn't be...it shows a pop up window called add reference. There I cant do nothing to add a dLL. Here I'm using visual c++ 2005.
I have no problem with it, I can even browse for .exe, .lib files, besides .dll files.
The selected file will appear in solution explorer in a folder called references.
But if it doesn't work, follow the advice of Ancient Dragon.
ddanbe
Senior Poster
3,829 posts since Oct 2008
Reputation Points: 2,070
Solved Threads: 661
Visual Studio is a development environment in wich you can have compilers for C++, C#,J++,Visual Basic and others. I use Visual C# most of the time and I can write managed and unmanaged code with it. But I like managed code. I can't count the hours I have wasted in C++ on figuring out why my handles and pointers where already in the "twilight zone" when they shouldn't be...
.
As I suspected, you are using VS to write managed code, not unmanaged plain-jane c++ code as most of the rest of us do. Nothing wrong with that, but you provide a solution to a different problem.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
I was answering a question about visual studio 2005.
You are right, writing unmanaged plain-jane c++ code(nothing wrong with that!) is not my cup of tea anymore...
But can you use VS to write really native, unmanaged code? I wonder.
ddanbe
Senior Poster
3,829 posts since Oct 2008
Reputation Points: 2,070
Solved Threads: 661
But can you use VS to write really native, unmanaged code? I wonder.
Yes, it is definately possible for C/C++. C#, probably not, but we are not discussing C# in this board.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
Thanks for your answers anyway. I would not dare to discuss C## in this forum.
Happy programming!
ddanbe
Senior Poster
3,829 posts since Oct 2008
Reputation Points: 2,070
Solved Threads: 661