从C ++源文件创建Windows DLL [英] Creating Windows DLL from C++ source files

查看:122
本文介绍了从C ++源文件创建Windows DLL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在C ++中有多个源文件,我想使用它创建一个动态链接库。



我看到这种情况发生在linux中,使用gcc -shared和ln



然而对于Windows,我想我必须修改源文件来生成一个DLL。



有没有办法使用提供的源文件生成DLL(与linux中的* .so文件类似的文件)。请纠正我,如果我错了,我想*所以是linux的dll。



需要这个的原因是使用SWIG在Windows Platfrom中的python中调用C ++函数。我被困在需要我在Windows中生成dll的步骤。

解决方案

确切的方法取决于你是哪个编译器使用,但程序可能记录。例如,如果要使用Visual Studio创建DLL,则可以使用演练 here


I have multiple source files in C++ using which i want to create a Dynamic link library.

I see this happening in linux with gcc -shared and ln

however for Windows i suppose i would have to modify source files to generate a DLL.

Is there a way to generate DLL (a file similar to *.so in linux) with provided source files. Please correct me if i m wrong, i think *so is dll for linux.

The reason for needing this is to use SWIG for calling C++ functions in python in Windows Platfrom. I am stuck at the step that requires me to generate a dll in windows.

解决方案

The exact approach depends on which compiler you are using, but the procedure is probably documented. For example, if you want to create a DLL using Visual Studio, a walkthrough is available here.

这篇关于从C ++源文件创建Windows DLL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆