help understanding import libraries

Andrew Wiley wiley.andrew.j at gmail.com
Fri Aug 19 10:56:34 PDT 2011


On Fri, Aug 19, 2011 at 9:38 AM, Jesse Phillips
<jessekphillips+D at gmail.com>wrote:

> maarten van damme Wrote:
>
> > 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 :)
>
> The process of creating an executable goes from generating machine code
> from source to linking the machine code for execution, as you know. The -I
> flag is the compiler import/include directory while -L is flags passed to
> the linker. That so while you may have complete source code in the import
> directory the compiler is only looking at the declaration and does not
> compile the files, it then informs the linker where the symbols can be found
> from the information you provide after the -L flag.
>

Technically it's not saying anything about where the symbols can be found,
it's just putting them into the object file as external symbols that the
linker needs to resolve, but yes. The compiler basically ignores lib files
and passes them to the linker.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20110819/4b264919/attachment.html>


More information about the Digitalmars-d-learn mailing list