带有 Gradle cpp 插件的 Buld DLL
Buld DLL with Gradle cpp plugin
有一个模块:
mod-native
------ build
------ sources
------------ myDll
----------------------- cpp
------------------------------ dllmain.cpp
------------------------------ MakeString.cpp
------------------------------ stdafx.cpp
------------------------------ MyDll.cpp
----------------------- headers
------------------------------ base64.h
------------------------------ tmain.h
------ build.gradle
所以,我的build.gradle
apply plugin: 'cpp'
model{
toolChains{
vs(VisualCpp){
installDir "C:\Microsoft Visual Studio 12.0"
windowsSdkDir "C:\Microsoft SDKs\Windows\v7.0"
}
}
// target binary for win32
platforms{
win32{
architecture "i386"
operatingSystem "windows"
}
}
components {
toCms(NativeLibrarySpec){
sources{
cpp{
source.srcDir "sources/myDll/cpp"
exportedHeaders.srcDir "sources/myDll/headers"
}
}
}
}
}
我想获取 MyDll.dll 文件,但似乎 gradle 试图构建 *.lib 文件而不是 *.dll。如何构建 MyDll.dll ??谢谢!
如果未指定,gradle 将同时构建 *.lib 和 *.dll,这取决于您执行的任务。
如果您执行任务 toCmsDebug共享库,它应该可以工作
注意:您应该使用 gradle 默认布局(因此您不必手动设置 srcDir):
src/
----*component name*/
---------cpp/
---------headers/
注2:当你想编译一个*.exe时,请确保你运行以"install"开头的任务(例如:installMyCmsDebugExecutable),这有很大的不同,因为Visual Studio将运行这个。
您可以在 *.vcxproj, xml 标记中检查为构建执行了哪个任务<NMakeBuildCommandLine>
相关文章:
- 挂起和取消挂起一个文件DLL
- std::threads可以从Windows DLL中的全局变量创建/销毁吗?
- 导入库可以跨dll版本工作吗
- 从C++dll访问C#中的一行主要参数
- 链接到自行创建的dll失败
- 为什么使用 P/Invoke 调用 dll 时,某些计算机中的 LoadLibrary 失败?
- 在调用FreeLibrary后,释放动态链接到具有相同版本的CRT堆的DLL的内存
- 如何指定我希望我的LIB链接到的DLL文件?-Visual Studio 2019
- 如何将图像传输到c++(dll)中的缓冲区,然后在c#的缓冲区中读/写
- C++:将外部库链接到dll库
- 在 Windows 上,是否可以让 dll 在不使用 PATH 环境变量的情况下在另一个文件夹中查找依赖项?
- 不同的Visual Studio版本中缺少.dll
- 从DLL中删除类的实例
- 如何包装第三方DLL在R中使用
- 使用c#访问c++dll中带有char*参数的函数时发生AccessViolationException
- 系统.将数组移交给c#中动态加载的c++DLL时发生AccessViolationException
- 为什么导入Mixed native/CLR lib.dll的本机C++应用程序没有在Mixed lib.dll中的外部变
- 当我使用 C++ 中的 C# dll 来使用 Selenium 时,存在异常处理问题
- Python ctypes:不会按预期加载 dll
- 带有 Gradle cpp 插件的 Buld DLL