Lets take a program:
1 2 3 4 5 6
|
#include <iostream>
int main() {
std::cout << "Hello\n";
return 0;
}
|
Did I use dlopen or dlsym? No.
Does that mean that no shared object (aka dynamic library, e.g. .so) is involved? No.
The compiler creates an object file based on this source code. This code refers to identifier
std::cout
and operator
<<
. The operator is a function call. Those two must have been declared within the header file (for we did not declare them), but their implementation is in a library. The object file will contain only references/calls to the external symbols.
The compiler is followed by the linker, which takes object file(s) and libraries and creates an executable. Will the executable have everything in it? No.
The executable has equivalents of dlopen and dlsym, which are executed while we load our program; the necessary libraries are loaded when we start our program, and when we reach the "print hello", functions of the library are called.
The standard libraries that provide those functions are automatically considered by the linker. Your third-party library has to be mentioned for the linker.
1. In source code:
1a) include header(s)
1b) use types and functions declared in header(s)
2. Tell your "does everything" Netbeans to use the "thostmduserapi.so" in your project.