In the past two days, the customer asked how to use the dynamic library in the issued SDK, but he had not done it before. From yesterday till now, he finally got it done.
Here, we only describe the simple method.
Reference URL:
Http://www.oschina.net/question/54100_32476
The dynamic library is compiled as follows:
Gcc-FPIC-shared car. C ship. C-o libtranic. So
It is important that you have a-shared option to specify the dynamic library to be generated.
The header file of the dynamic library is the same as the common. h file, so no special requirements are required.
The dynamic library is used as follows:
Gcc-O test. c libtranic. So
Add this dynamic library at the end of the compilation item. If compilation is divided into compilation and link, it should end with the link.
Note: When I use the-L option, errors are always prompted.
Here is just a simple method. To illustrate the problem, there may actually be a lot of applications that won't be used in this way, but they are handled in a "regular" way, for example, to place a dynamic library to the lib directory of the system, we will not discuss it here