How to use an external dll file in VisualStudio project
2012-09-19 15:52
701 查看
Date: Sep 19' 2012
by xyz
There are three approach to use the dll in our project, using '#pragma commen',
symbol '#import' or function LoadLibrary decleared by file <Windows.h>. But now,
we discuss the first way, and it ask we to prepare three parts of the dll: headfile,
.lib and the .dll file also. Assume we have three parts of an exsited project.
File list:
a. MyHeadFile.h
b. MyLib.lib
c. MyLib.dll
Now please open your vs solution and complete the follow steps:
-----------------------------------------------------------
a. open project's [properties]
b. select [Configuration Properites] -> [VC+ Directores], in the right Greneral page,
fill the full path of file MyHeadFile.h into [Include Directories], and fill the
[LibraryDirectories] with File MyLib.lib path.
c. go back to left bar, find [Linker] and select [Input] in the layer list.
d. fill file MyLib.dll' name in table [Additional Dependencies].
e. select OK to save your change and quit.
How to use the exports class or functions in the dll file?
-------------------------------------------------------------
Open your main file in the current solution, and include the head file you need,
in this sample , it would be #include "MyHeadFile.h", and don't forget to using macro
#pragma comment(lib,"MyLib.lib") in your main source file. After finished the whole
steps above, you can use the classes or functions that decleared and implemented in
the .dll file your just import.
by xyz
There are three approach to use the dll in our project, using '#pragma commen',
symbol '#import' or function LoadLibrary decleared by file <Windows.h>. But now,
we discuss the first way, and it ask we to prepare three parts of the dll: headfile,
.lib and the .dll file also. Assume we have three parts of an exsited project.
File list:
a. MyHeadFile.h
b. MyLib.lib
c. MyLib.dll
Now please open your vs solution and complete the follow steps:
-----------------------------------------------------------
a. open project's [properties]
b. select [Configuration Properites] -> [VC+ Directores], in the right Greneral page,
fill the full path of file MyHeadFile.h into [Include Directories], and fill the
[LibraryDirectories] with File MyLib.lib path.
c. go back to left bar, find [Linker] and select [Input] in the layer list.
d. fill file MyLib.dll' name in table [Additional Dependencies].
e. select OK to save your change and quit.
How to use the exports class or functions in the dll file?
-------------------------------------------------------------
Open your main file in the current solution, and include the head file you need,
in this sample , it would be #include "MyHeadFile.h", and don't forget to using macro
#pragma comment(lib,"MyLib.lib") in your main source file. After finished the whole
steps above, you can use the classes or functions that decleared and implemented in
the .dll file your just import.
相关文章推荐
- How to use an external dll file in VisualStudio project
- How to build an OLE DB application for SQL Server CE in Visual Studio 2005
- How to use Intel C++ Compiler in Visual Studio 2008
- How to use GCC to build DLL by DEF file in MinGW?
- How To Use ADO.NET to Retrieve and Modify Records in an Excel Workbook With Visual Basic .NET(利用Ado.net导出到Excel)
- How To Use a DataReader Against an Oracle Stored Procedure in Visual C# .NET
- buildconfigurationHow to use Boost in Visual Studio 2010
- How to use Boost in Visual Studio 2010
- How to create a project with existing folder of files in Visual Studio?
- How to build mex file directly in Visual Studio 2010?
- an oracle article in high level to descibe how to archtichre operator JAVA relevet project
- How to debug release mode program in visual studio
- How to use IMGDECMP.DLL in WindowsCE
- HOWTO: Get the project flavor (subtype) of a Visual Studio project from an add-in
- How to create a DLL library in C and then use it with C#
- How to use composition and inheritance in visual c# ?
- Visual Studio Tips: How to change project namespace
- How to Access and Use the Windows Hosts File in Windows 7 and Vista
- How to: Add an Action Method to an MVC Controller in Visual Studio
- How to use an Outlook Object Model from Visual C++ by using a #import statement