如何在D程序中链接到D库 [英] How to link to D Libraries in a D program

查看:87
本文介绍了如何在D程序中链接到D库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是D编程语言的新手,有一个非常简单的问题。

I´m new to the D Programming Language and have a very simple problem.

我想一次编译一个D脚本库,然后在其他库中使用它D项目。

I want to compile a D Script Library once and then use it in my other D projects.

在CI中链接到.lib文件并为其创建了标头,但在DI中找不到类似的东西(甚至还有某种标头)

In C I linked to the .lib files and created headers for them, but in D I don´t find things like that (are there even some sort of headers in D?)

我将D-IDE用作IDE,将DMD2用作编译器。

I use D-IDE as my IDE and DMD2 as my compiler.

推荐答案

有.di(D接口)文件可用作标题,这些文件可通过-H编译器开关从您的源文件生成。

there are .di (D interface) files which can be used as header these can be generated from your sources with the -H compiler switch

无论如何,我见过的库将只包含要导入的源文件

however the libraries I've seen will just have the source files to import

您可以使用-I开关指定编译器将在哪里寻找导入文件

you can use the -I switch to specify where the compiler will look for imports

-L开关将传递给链接器

and the -L switch will be passed to the linker

这篇关于如何在D程序中链接到D库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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