Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8941277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:15:46+00:00 2026-06-15T11:15:46+00:00

I have just one question related to Linux shared library files. I saw lot

  • 0

I have just one question related to Linux shared library files.

I saw lot of links related to dynamically shared library for the Linux O.S
http://www.yolinux.com/TUTORIALS/LibraryArchives-StaticAndDynamic.html

Here in above link it is mentioned —
include file for the library: ctest.h

Now in LINUX to use the libdl in build function — dlopen, dlsym, dlclose.
Do we really need to include the prototype file — ctest.h — for dynamic lybrary ?

Please give some suggestion related to above post.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T11:15:48+00:00Added an answer on June 15, 2026 at 11:15 am

    You don’t really need to include the header or prototype file for the dynamic library, you do however need to at least the specific type information for the value returned by dlsym.

    See here and here for examples that don’t contain the include file for the dynamic library.

    In the example you posted, they started off with their library functions not having header files / function prototypes, which along with providing instruction on how to avoid C++ name mangling is why they included the header file in this case.

    If you define your own libraries without function prototypes, either in the source file or the header file, then you will need to include the header file when using dlsym, otherwise the inclusion of the header file of the dynamic library is unnecessary as its function prototypes were already included in the generated shared object.

    The function prototypes included in header file are so that functions implemented can be resolved by name by linker. Where as the shared object file regardless of how it is linked, contains the implementation of the library which the linker links to.

    The short explanation is that header files that are included with the #include are processed by the preprocessor, which means the resulting source file / files passed to the linker has knowledge of who each function call is because it looks up the function call prototype that was in the include file and has been included in the modified source. Include files tell the linker about who the function call is.

    Object files, Shared Object files and other libraries files tell either the linker about what the implementation of the function call prototype does.

    To answer your question in the comment, you will only have to add the libdl.so path to LD_LIBRARY_PATH or to /etc/ld.so.conf and run ldconfig, if that library or its relevant symlink hierarchy isn’t in a standard location such as /usr/lib/ or /lib/.

    See the following relevant StackOverflow answer answer for more information.

    Further information can be found at

    • Program Library Howto
    • C Libraries Howto
    • Compilers, Assemblers, Linkers, Loaders: A Short Course
    • Linkers and Loaders
    • Beginner’s Guide to Linkers
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a similar question to the one I just asked. I'm trying to
I have just updated to Snow Leopard and one of my important Flash files
A related question to one I asked earlier ... Just checking on something: Should
I have just one cs file in my repository which Git seems to think
In my C# codebehind file(.cs), I have just one class and it is derived
With my database upgrade scripts, I typically just have one long script that makes
To localitie items in the standard directories, I have just used either one of
I have just re-written the authentication for one of our internal web applications to
i have a menu that contains just one item. Button exit; @Override public boolean
I have a Web Service with Just one Web Method that returns a boolean

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.