cl.exe编译dll,并使用dll
点击 17344 创建时间 2013-04-02 10:02:20
@set "PATH=D:\Program Files\Microsoft SDKs\Windows\v7.1\Bin;%PATH%"
@set "INCLUDE=D:\Program Files\Microsoft SDKs\Windows\v7.1\Include;%INCLUDE%"
@set "LIB=D:\Program Files\Microsoft SDKs\Windows\v7.1\Lib;%LIB%"
@set "LIBPATH=D:\Program Files\Microsoft Visual Studio 10.0\VC\lib;%LIBPATH%"
call "D:\Program Files\Microsoft Visual Studio 10.0\VC\bin\vcvars32.bat"
cd debug
cl.exe /D_USRDLL /D_WINDLL ../WudimeiDll.cpp User32.lib Kernel32.lib Gdi32.lib /link /DLL /OUT:WudimeiDll.dll
cl.exe ../w.cpp /link User32.lib Kernel32.lib Gdi32.lib WudimeiDll.lib /OUT:w.exe
w.exe
pause
编译出了w.exe和WudimeiDll.dll两个文件,要放到一起才能使用,要不然会出现“找不到dll”的错误。
D:\projects\vc10\window>call "D:\Program Files\Microsoft Visual Studio 10.0\VC\bin\vcvars32.bat"
Setting environment for using Microsoft Visual Studio 2010 x86 tools.
D:\projects\vc10\window>cd debug
D:\projects\vc10\window\debug>cl.exe /D_USRDLL /D_WINDLL ../WudimeiDll.cpp User32.lib Kernel32.lib Gdi32.lib /link /DLL /OUT:WudimeiDll.dll
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
WudimeiDll.cpp
D:\Program Files\Microsoft Visual Studio 10.0\VC\INCLUDE\xlocale(323) : warning
C4530: C++ exception handler used, but unwind semantics are not enabled. Specify
/EHsc
Microsoft (R) Incremental Linker Version 10.00.30319.01
Copyright (C) Microsoft Corporation. All rights reserved.
/out:WudimeiDll.exe
/DLL
/OUT:WudimeiDll.dll
WudimeiDll.obj
User32.lib
Kernel32.lib
Gdi32.lib
Creating library WudimeiDll.lib and object WudimeiDll.exp
D:\projects\vc10\window\debug>cl.exe ../w.cpp /link User32.lib Kernel32.lib Gdi32.lib WudimeiDll.lib /OUT:w.exe
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
w.cpp
Microsoft (R) Incremental Linker Version 10.00.30319.01
Copyright (C) Microsoft Corporation. All rights reserved.
/out:w.exe
User32.lib
Kernel32.lib
Gdi32.lib
WudimeiDll.lib
/OUT:w.exe
w.obj
Creating library w.lib and object w.exp
D:\projects\vc10\window\debug>w.exe
D:\projects\vc10\window\debug>pause
请按任意键继续. . .
上一篇: 小试windows sdk 7.1中的编译器
下一篇: apache ftp服务器是一款优秀的软件