|
|
| Use win32 dll in the window application |
|
| Author |
Message |
idos

|
Posted: Visual C++ General, Use win32 dll in the window application |
Top |
Hi,
I try to reuse my code from a win32 console application to a window application project,
Then I try to make dll of win32 project and add it to the new window project, but I get error that said my win32 project is not .Net assembly.
Can some one show me how to reuse my code or do I have to copy paste all the code and recompile it
Thank you in advance, sorry for my poor english
Visual C++5
|
| |
|
| |
 |
Alex Farber

|
Posted: Visual C++ General, Use win32 dll in the window application |
Top |
To use unmanaged Win32 Dll in other C++ application, you need to add .lib file to the Linker dependencies list, include Dll interface h-file to the client project .cpp file, and call Dll functions. This way works both for unmanaged and managed client. Unmanaged Win32 Dll cannot be added as reference, this way works only for .NET class libraries.
|
| |
|
| |
 |
idos

|
Posted: Visual C++ General, Use win32 dll in the window application |
Top |
I tried your suggestion, but it's still not working. Can you pointed out where I made a mistake, please.. so first I make an empty win32 project, its name is ProjectUnManaged. and inside, I made a class MyUnManaged, inside that class I created a method void sayHi()
after that I compile the target to get a ProjectUnManaged.lib and ProjectUnManaged.dll
From this point I am a bit confuse, so I make a new Window Application project, I go to the projectproperties-> linker-> input -> additional dependencies and then put in ProjectUnManaged.lib
After that in my Form1.h I put #include "MyUnManaged.h"
Up to this point I tried to build the window application project, and I got error that said cannot found MyUnManaged.h ...
What did I do wrong
please help me......
|
| |
|
| |
 |
Alex Farber

|
Posted: Visual C++ General, Use win32 dll in the window application |
Top |
Ensure that compiler can find MyUnManaged.h file and linker can find MyUnManaged.lib file. To do this, specify full or relative path to h and lib file names, or add directories where these files are placed, to the list of VC++ directories for include and library files: Tools - Options - Projects and Solutions - VC++ directories.
You can add these directories only for client project: Project - Properties - C/C++ - General - Additional Include Directories. Type here directory where MyUnmanaged.h is placed. Similar parameter exists for linker, add directory with MyUnmanaged.lib there.
|
| |
|
| |
 |
| |
|