在 GCC 或 Cygwin 中创建 DLL?
我需要帮助将脚本(“iterator.c”)编译为 DLL。我无法使用 VS2010,因为它不支持 C99 标准中添加到 C 的功能(我使用“complex.h”,但 VB 不支持它)。
我一直在寻找替代品,但我发现的是 GCC,我不知道如何安装/使用(真的,我花了半个小时阅读文档,我什至不明白如何安装/使用)我应该安装它吗?)和 Cygwin,我已经安装了它,但我不知道如何使用。另外,我已经安装了MinGW,但我认为它与Cygwin或多或少相同,而且我仍然不知道如何制作DLL。
这并不是说我太懒了,甚至没有尝试过,只是这些编译器与我以前使用过的任何编译器都不一样(主要是 Python IDLE 和 Visual Studio,这让你的事情变得非常简单)。我有点迷失了。
有人可以给我一些关于如何使用这个工具来制作一个可以从另一个脚本访问的 DLL 的建议吗?这真的很重要。
I need help to compile a script ("iterator.c") into a DLL. I can't use VS2010 since it does not support the features added to C in the C99 standard (I'm using "complex.h" but VB doesn't support it).
I've been looking for a substitute but all I've found is GCC which I don't know how to install/use (really, I've spent like half an hour reading through the documentation and I don't even understand how am I supposed to install it), and Cygwin, which I've already installed but I don't know how to use either. Also, I've installed MinGW but I think it's the same as Cygwin more or less, and I still don't know how to make a DLL.
It's not like I've been all lazy and haven't even tried it, it's just that these compilers aren't like nothing I've ever used before (mostly Python IDLE and Visual Studio, which make things pretty easy for you). I'm kind of lost.
Could someone give me some advice on how to use this tools to make a DLL that I can access from another script? It is really important.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须将 __declspec(dllexport) 放在您希望导出的方法前面,例如,您可以#define this to max it更容易
编译dll使用
然后附加
编辑:忘记了最重要的部分,您需要制作一个mydll .h 文件包含您的方法定义,以便编译器知道为链接器保留一个位置以便稍后填充。就这么简单
You must place __declspec(dllexport) in front of the method you wish to export such as, you could #define this to max it easier
To compile the dll use
then to attach
EDIT: Forgot the most important piece, you need to make a mydll.h file to include your method definition so the compiler knows to reserve a spot for the linker to fill in later on. It's as simple as