Hi, I am relatively new to C and C++ (~2 months), having previously done all my programming in Object Pascal. My question is this: How does the linker know where to find object code for functions prototyped in header files?
In Object Pascal, the functions would either be DEFINED in a file, either in OP code, or in assembler (e.g. the writeln function, which outputs text to a console, is found in the writestr.asm file in the include directory), or the relevant DLL would be specified, e.g.
to include a function which is called whatever in somedll.dll and call it SomeFunction in the header file. However with C, there appears to be no such methodology. If I look at the header files, e.g. stdio.h, I just find lists and lists of prototypes, with no reference to object code.Code:function SomeFunction; external 'somedll.dll' name 'whatever';
My question arises because I am using a non-standard header file called conio.h. I use Dev-C++ and it provides a source file conio.c, but I have to compile it myself (to e.g. conio.o), and then pass the linker the path to the object code which I have compiled everytime I wish to run my program.
Now, there must be an easier way to do this. Surely the linker has some kind of search path where it looks for the object code, and surely SOMEWHERE there must BE object code for things like printf? And how does the compiler know for the functions in windows.h which DLL it has to look in to find, e.g. CreateWindow?
It would be helpful if someone could either help me on this or point me somewhere I could find more info, since the book I am using does not appear to cover it.
Thanks in advance,
Adam.