2

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?

Gary Willoughby
  • 50,926
  • 41
  • 133
  • 199

2 Answers2

3

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.

Asherah
  • 18,948
  • 5
  • 53
  • 72
Eyyub
  • 31
  • 1
2

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

ratchet freak
  • 47,288
  • 5
  • 68
  • 106
  • What's the easiest way of linking `libgtkd.a` on Linux? – Gary Willoughby Jun 06 '12 at 22:09
  • I found the problem on Windows why the static lib being linked had no effect and that's because the `*.di` files where not generated during the compilation. I checked the build file and it needed the `-H` compiler command adding. Once i did this and recompiled it all worked nicely. I'm still haven't got Linux linking the GtkD libs correctly yet i might open another question for why not. – Gary Willoughby Jun 07 '12 at 18:15