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 487139
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T01:34:28+00:00 2026-05-13T01:34:28+00:00

I am building .so library and was wondering – what is the difference b/w

  • 0

I am building .so library and was wondering – what is the difference b/w -h and -o cc complier option (using the Sun Studio C++) ?

Aren’t they are referring to the same thing – the name of the output file?

  • 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-13T01:34:28+00:00Added an answer on May 13, 2026 at 1:34 am

    -o is the name of the file that will be written to disk by the compiler

    -h is the name that will be recorded in ELF binaries that link against this file.

    One common use is to provide library minor version numbers. For instance, if
    you’re creating the shared library libfoo, you might do:

    cc -o libfoo.so.1.0 -h libfoo.so.1 *.o
    ln -s libfoo.so.1.0 libfoo.so.1
    ln -s libfoo.so libfoo.so.1
    

    Then if you compile your hello world app and link against it with

    cc -o hello -lfoo
    

    the elf binary for hello will record a NEEDED entry for libfoo.so.1 (which you can
    see by running elfdump -d hello ).

    Then when you need to add new functions later, you could change the -o value to
    libfoo.so.1.1 but leave the -h at libfoo.so.1 – all the programs you already built
    with 1.0 still try to load libfoo.so.1 at runtime, so continue to work without being
    rebuilt, but you’ll see via ls that it’s 1.1.

    This is also sometimes used when building libraries in the same directory they’re
    used at runtime, if you don’t have a separate installation directory or install
    via a packaging system. To avoid crashing programs that are running when you
    overwrite the library binary, and to avoid programs not being able to start when
    you’re in the middle of building, some Makefiles will do:

    cc -o libfoo.so.1.new -h libfoo.so.1 *.o
    rm libfoo.so.1 ; mv libfoo.so.1.new libfoo.so.1
    

    (Makefiles built by the old Imake makefile generator from X commonly do this.)

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

Sidebar

Related Questions

I'm building a C# class library, and using the beta 2 of Visual Web
I'm building an .NET library and was wondering if there's any validation framework for
I am building a library using mvc, mongodb and asp.net membership. When a user
I'm building an application using ASP.net MVC 3 and I'm wondering if anyone knows
I am wondering what to include when building my project. I have a library
I'm currently building a library around the Google Analytics Data Export API. When i'm
I am building a library to automatically create forms for Objects in the project
I am building a library with a large body of source code for Android.
I'm building an Authentification library that's going to have around 45+ methods for dealing
I am building a class library, and I am getting an error and I

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.