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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:10:38+00:00 2026-06-13T11:10:38+00:00

I’m building .lib ( static library ) for a large project and I’d like

  • 0

I’m building .lib (static library) for a large project and I’d like to hide some function to end user of the library, but I need those functions to be callable from every .c file inside the library (thus not static).

This is exactly opposite to __declspec(dllexport) and I’ve already found a solution for gcc.

I’d like to use static, but static function should be available only inside “current .c file”, so this is not the way.

In another words: I need a way how can I tell Microsoft Visual C++ 2010 not to export some functions to final .lib (while keeping them available for all other .c files inside the project).

Note: I’ve never used __declspec (neither __attribute__( visibility)) in my whole solution, this is probably just some default setting associated with building static library (which I cannot trace).

  • 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-13T11:10:39+00:00Added an answer on June 13, 2026 at 11:10 am

    This just is not possible. What you are asking for has nothing to do with __declspec(dllexport), that’s an attribute that determines what identifiers are visible outside of a DLL. Which certainly will meet your requirement.

    But you are asking for a static library. Which is a very simple file format, it is just a bag of .obj files. Put together into an archive by lib.exe after compiling. Nothing happens at all to resolve dependencies between separately compiled .c files in the .lib. That doesn’t happen until the .lib is linked.

    At which point there is no difference at all between the identifiers with external linkage that the client code used and yours. Making any attempt to hide yours, if that would be possible, would just create link failure when the linker can’t figure out how to satisfy an external dependency of one of your .c files with another.

    The only way to get anywhere close is to have all of your code in a single translation unit with the functions marked static so they have no external linkage. That’s mighty ugly but could be done by a single file that #includes all the other .c files. Surely you’ll dismiss that option, so do pursue a DLL solution to get this.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I need to clean up various Word 'smart' characters in user input, including but
For some reason, after submitting a string like this Jack’s Spindle from a text
I need a function that will clean a strings' special characters. I do NOT
I want to construct a data frame in an Rcpp function, but when I
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into

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.