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

  • SEARCH
  • Home
  • 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 557477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T12:01:49+00:00 2026-05-13T12:01:49+00:00

In my quest to learn C++, I have come across dynamic and static libraries.

  • 0

In my quest to learn C++, I have come across dynamic and static libraries.

I generally get the gist of them: compiled code to include into other programs.

However, I would like to know a few things about them:

  • Is writing them any different than a normal C++ program, minus the main() function?
  • How does the compiled program get to be a library? It’s obviously not an executable, so how do I turn, say ‘test.cpp’ into ‘test.dll’?
  • Once I get it to its format, how do I include it in another program?
  • Is there a standard place to put them, so that whatever compilers/linkers need them can find them easily?
  • What is the difference (technically and practically) between a dynamic and static library?
  • How would I use third party libraries in my code (I’m staring at .dylib and .a files for the MySql C++ Connector)

Everything I have found relating to libraries seems to be targeting those who already know how to use them. I, however, don’t. (But would like to!)

Thanks!

(I should also note I’m using Mac OS X, and although would prefer to remain IDE-neutral or command-line oriented, I use QtCreator/Netbeans)

  • 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-05-13T12:01:49+00:00Added an answer on May 13, 2026 at 12:01 pm

    Is writing them any different than a normal C++ program, minus the main() function?

    No.

    How does the compiled program get to be a library? It’s obviously not an executable, so how do I turn, say ‘test.cpp’ into ‘test.dll’?

    Pass the -dynamiclib flag when you’re compiling. (The name of the result is still by default a.out. On Mac OS X you should name your dynamic libraries as lib***.dylib, and on Linux, lib***.so (shared objects))

    Once I get it to its format, how do I include it in another program?

    First, make a header file so the the other program can #include to know what functions can be used in your dylib.

    Second, link to your dylib. If your dylib is named as libblah.dylib, you pass the -lblah flag to gcc.

    Is there a standard place to put them, so that whatever compilers/linkers need them can find them easily?

    /usr/lib or /usr/local/lib.

    What is the difference (technically and practically) between a dynamic and static library?

    Basically, for a static lib, the whole library is embedded into the file it “links” to.

    How would I use third party libraries in my code (I’m staring at .dylib and .a files for the MySql C++ Connector)

    See the 3rd answer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my quest to learn C I've come across a task which is causing
In my quest to learn ActionScript 3.0 I have stumbled across another situation where
In my quest to generate new code in a Scala compiler plugin, I have
On my quest learning Java I come across one doubt. For sorting a unidimensional
on my quest to learn and improve my JavaScript I came across a script
I have a rather repetitive switch case statement and in my quest to learn
My noble quest is to get rid of singletons and static classes. Background: I
In my quest in trying to learn more about OOP in PHP. I have
On my quest to learn NHibernate I have reached the next hurdle; how should
Continuing my quest to learn more about Backbone.js I have arrived to a situation

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.