After compiling and generating the dynamic library *.so under Linux, we find that there is an error resolution when opening with Dlopen.

Source: Internet
Author: User

under Linux sometimes compiled source files may have syntax errors, but many times still can generate dynamic library, this time, with dlopen Open There is no way to return a handle, resulting in a dynamic library can be generated, but not open, this time the best way is not Dlopen A method that is called dynamically, but instead uses a static call method.

1, in the test file with a static call the required header file, while the header file in the same directory as the test file, so that the test file can find the header file

2, the generated library location output to /usr/lib(if it is a system, it is in the /usr/lib64) folder

3. Compile-time reference My Code, gcc main.c-l.-lisucard-o main(main.c is the test code, the generated library is named libisucaed. So)

4, this time if the library has a problem, compile test files will be error, this time according to the location of the error correction can be, so that can locate where there is a problem. When you've done the wrong thing, you can get what you want.

After compiling and generating the dynamic library *.so under Linux, we find that there is an error resolution when opening with Dlopen.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.