terminology refresher class ??
-
Building a ( static ) library. If we agree that DECLARATION are in header file and DEFINITIONS are in C++ .cpp source file what is a correct term for #include such library header file in code so the source code using the library have what ? "reference point" ? (and how does it correlate with linker ?)
-
Building a ( static ) library. If we agree that DECLARATION are in header file and DEFINITIONS are in C++ .cpp source file what is a correct term for #include such library header file in code so the source code using the library have what ? "reference point" ? (and how does it correlate with linker ?)
Haven’t seen any standard term. If you need such term, I’d rather go for “inclusion point”. The word “reference” has many uses and adding another one is not going to make things clearer. Anyway it has no direct relation to the linker. It is purely a textual inclusion and it will go through preprocessor and compiler before.
Mircea
-
Building a ( static ) library. If we agree that DECLARATION are in header file and DEFINITIONS are in C++ .cpp source file what is a correct term for #include such library header file in code so the source code using the library have what ? "reference point" ? (and how does it correlate with linker ?)
The source code may be using definitions of classes/functions etc in an external library. The header file provides this information so the compiler can create a reference in the object code. Such references will then be used by the linker to fix the links to a library or other object code module. For example given the followin directory structure:
PROJECT
LIB
CLIENTyou might have:
// Library.h the defintions of the library, in the LIB subdirectory
void Foo(char* name);// Library.c the implementation of the library, in the LIB subdirectory
void Foo(char* name)
{
printf("Hello, World! A message from %s\n", name);
}//Implementor.cpp the program that will use the library, in the CLIENT subdirectory
#include "../LIB/Library.h"
int main(int argc, char** argv)
{
Foo("fred");return 0;
}
Does that make sense?
-
The source code may be using definitions of classes/functions etc in an external library. The header file provides this information so the compiler can create a reference in the object code. Such references will then be used by the linker to fix the links to a library or other object code module. For example given the followin directory structure:
PROJECT
LIB
CLIENTyou might have:
// Library.h the defintions of the library, in the LIB subdirectory
void Foo(char* name);// Library.c the implementation of the library, in the LIB subdirectory
void Foo(char* name)
{
printf("Hello, World! A message from %s\n", name);
}//Implementor.cpp the program that will use the library, in the CLIENT subdirectory
#include "../LIB/Library.h"
int main(int argc, char** argv)
{
Foo("fred");return 0;
}
Does that make sense?
-
Haven’t seen any standard term. If you need such term, I’d rather go for “inclusion point”. The word “reference” has many uses and adding another one is not going to make things clearer. Anyway it has no direct relation to the linker. It is purely a textual inclusion and it will go through preprocessor and compiler before.
Mircea
-
It does not clearly define what I was asking for. But I sort of like the relation "definition" library client
-
So a combination of Richard's
library
clientwith "client's inclusion point #include " would make some sense.
Sorry, I don't understand what you try to accomplish. Are you trying to document how your library has to be used by a client program? In this case, I've seen instructions like: "... place an include directive to in your program" or even: "... place an include directive to before the include directive for " If you are looking for something else, try to explain more.
Mircea
-
Sorry, I don't understand what you try to accomplish. Are you trying to document how your library has to be used by a client program? In this case, I've seen instructions like: "... place an include directive to in your program" or even: "... place an include directive to before the include directive for " If you are looking for something else, try to explain more.
Mircea
I was trying to find if there is a specific term for the process , not just "place include..." Something similar to declare function define function relation. I guess there is none. However years ago there was a book of C code standards - something "ANSI C ..." maybe it is in there. I used to have a copy.
-
I was trying to find if there is a specific term for the process , not just "place include..." Something similar to declare function define function relation. I guess there is none. However years ago there was a book of C code standards - something "ANSI C ..." maybe it is in there. I used to have a copy.
It is still not clear what you mean by "the process". There is no process as such, you just need to ensure that the compiler can find all declarations and/or definitions of any functions that you are trying to use. Either within your source file or in an associated header.