构建开源库 DLL 供 Windows 开发人员使用的最佳方法是什么?
我有几个使用 GNU 工具链(automake、conf、flex、bison、gcc...)在 Linux 和 OSX 上开发的 C 自由软件/开源库,但我偶尔会收到提供 Windows DLL 的请求。 我希望能够提供这些功能,而无需在 Windows Visual Studio 开发上花费大量时间和金钱。 我确实有一个可用的 Windows XP 虚拟机,而且我也知道该软件是可移植的,因为我偶尔会获得补丁以使其内置于 Windows 上。
我应该使用什么方法或工具? 在Linux上交叉编译? 使用 Visual Studio Express 还是其他? 我更喜欢 SVN 存储库完全自动化的东西。 我不认为 cygwin 是一个解决方案,因为据我所知,它似乎没有提供 Windows 开发人员所需的东西 - 链接和 DLL。
I have several C free software/open source libraries that I develop on Linux and OSX with the GNU toolchain (automake, conf, flex, bison, gcc, ...) but I occasionally get requests to provide Windows DLLs. I'd like to be able to provide those without having to spend a lot of time and money with Windows Visual Studio development. I do have a Windows XP virtual machine available and I also know the software is portable as occasionally I get patches to make it build in on windows.
What approaches or tools should I be using? Cross compiling on Linux? using Visual Studio Express or something else? I would prefer something that is fully automated from a SVN repository. I do not count cygwin as a solution since that does not seem to provide what Windows developers need, as far I understand the issues - linking and DLLs.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您可以尝试使用 Mingw 与 MSYS、Visual Studio (Express) 与 SUA(unix 应用程序子系统)或 Cygwin 来编译基于 automake/autoconf 的程序(./configure && make 在 linux 下构建)。
不幸的是,他们创建的 lib 文件通常与其他编译器不兼容,因此如果您希望您的库与使用 Visual Studio 开发的应用程序一起使用,那么您应该使用 VSC++ 方法。 通常很多 GNU 项目(检查 gnuwin32)实际上也有 VC 兼容的构建脚本,可以使用“nmake”
You can try Mingw with MSYS, Visual Studio (Express) with SUA (subsystem for unix application) or Cygwin to compile programs that are automake/autoconf based (./configure && make to build under linux).
Unfortunately usually the lib file they create is not compatible with other compilers, so if you want your library to work with an application that is developed using Visual Studio, then you should use the VSC++ approach. Usually a lot of GNU projects (check gnuwin32) actually have VC compatible build scripts too, than can be compiled using "nmake"
您可以使用 MinGW 或从 MinGW 安装 MSVC 命令行工具。 microsoft.com/Express/vc/" rel="nofollow noreferrer">Visual Studio Express。
其中任何一个都可以由命令行脚本驱动。
我想从 Linux 进行交叉编译也可以,但我不知道这可能有多容易(或多痛苦)。
这篇简短的文章展示了 Windows 应用程序和应用程序的简单交叉编译。 在 Wine 下运行该应用程序:
You could use MinGW or install the MSVC command line tools from Visual Studio Express.
Either of those can be driven by command line scripts.
I imagine a cross compile from Linux would also work, but I have no idea how easy (or painful) that might be to get going.
This short article shows a simple cross compile of a Windows application & running that app under Wine:
Windows 软件开发工具包包括 Microsoft 的 C/C++ 编译器(仅命令行,没有可视化工具),因此您甚至不需要 Visual C++ Express Edition。 Windows SDK 可以从 Microsoft 免费下载。
The Windows Software Development Kit includes Microsoft's C/C++ compiler (command line only with no visual tools), so you don't even need Visual C++ Express Edition. The Windows SDK is a free download from Microsoft.
如果您使用 http://www.cmake.org/,cmake 可以创建 Makefile(用于Unix)和项目文件(对于 Visual Studio)。 这就是 KDE 项目正在使用的内容。
Visual Studio 的编译器可以从 Windows 命令行在 cmake 生成的文件上使用“devenv /build debug project.csproj”启动。 但是,这确实需要安装了(可能免费的)Visual Studio 的 Windows(可能在 VM 中)。
If you're using http://www.cmake.org/, cmake can create the Makefile (for Unix) and project file (for Visual Studio). This is what for example the KDE project is using.
Visual Studio's compiler can be started from a Windows command line with 'devenv /build debug project.csproj' on the cmake generated file. This does however require a Windows (possibly in a VM) with a (potentialy free) Visual Studio installed.