I'm really getting confused as to how import libraries actually work.<div>Someone once told me that in order to use an import library one has to write d files declaring the functions so that the dmd compiler knows what's in the lib files.</div>
<div>I've never thought any further untill I compiled the gtkd project to a lib file.</div><div><br></div><div>the compiler flags I needed to add was -I for every src directory and -L for the lib file. The problem with that was that those files in the src dir don't declare the functions but also define them. They are the real source code files so I didn't understand why the -L flag was necessary. I never experimented further though :)</div>
<div><br></div><div>Today I've looked  in the lib files and saw that phobos.lib was there. just for fun I decided to compile a simple hello world file and compile it with the standard compiler options. Then I compiled without linking and did the linking manually. The resulting executable was 146 kb while the executable using the standard compiler options was almost 2 megabytes.</div>
<div><br></div><div>Is the compiler really including all the "garbage" I use from phobos from the source files instead of linking to the phobos.lib file? Can I avoid this? does the -L flag pointing to my gtkd.lib file actually do something?</div>
<div><br></div><div>Secondly I've also used implib to convert a dll file to a .lib file. The resulting lib file was WAY smaller then the dll file so I concluded that the lib file only contains information like this:</div>
<div>in dll XXX</div><div>function YYY at export adress Y</div><div>function ZZZ at export adress Z</div><div>...</div><div><br></div><div>But where does the lib file searches for the dll file? how can we control that? Is my hunch right?</div>
<div><br></div><div>Maarten</div><div><br></div>