GtkD (the Gtk+bindings for the D language) why compile it?

吃可爱长大的小学妹 提交于 2019-12-08 02:53:53

问题


I've recently been using GtkD with the D programming language to create native applications. I've downloaded all the necessary files and got everything running so i can now compile and produce sample apps.

My question is that in some of the guides it tells you to compile GtkD on the platform you are using but what is the point? Once compiled you end up with a single lib file on Windows (GtkD.lib) and three lib files on Linux (ending in *.a). What are these files for and how are they used? Like i said everything seems to be working without doing anything with these files.

I'm guessing you can statically link these? but what's that for? To avoid compiling the GtkD source each time? I did actually try that using the pragma('lib', 'GtkD.lib') statement but it didn't seem to do anything.

Can anyone shine any light on this or explain why these files are needed?


回答1:


source files that are imported aren't compiled, they are only parsed for the symbol names and function signatures (and the templates)

creating libs is to avoid needing to recompile the entire library each time you need to rebuild and the compiler can then only use the .di files for the imports

this stems from the olden days where compiling took ages, and now it can be used to keep a library closed source




回答2:


Yes it's to avoid compiling the GtkD source each time.

Try to use pragma(lib, "GtkD"); rather than pragma('lib', 'GtkD.lib');

It works for me.



来源:https://stackoverflow.com/questions/10905212/gtkd-the-gtkbindings-for-the-d-language-why-compile-it

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!