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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:49:57+00:00 2026-06-14T03:49:57+00:00

I am writing a small API library sort of module in C. I will

  • 0

I am writing a small API library sort of module in C. I will compile this module and give it to my fellow developers and I will expose some required functions in header file of my module so developers who will use my module know which function to call for required functionality. Now I want to inquire one thing: Can I expose only desired functions in C. e.g.

I have test.c having:

#include "test.h"
void A()
{
  if( some condition is true )
    B();
  else
   return;
}

void B()
{
  //some code here
}

and in test.h, I have only one function exposed i.e.

void A();

Now B() clearly is dependent on condition put in A() otherwise it can not be run and as only A() is exposed in test.h then user wont know that he/she can also directly call B(). Now my fear is that if user gets to know (or by guess) that there is some function in my module called B() which can be called directly by bypassing A(), then it can compromise my implementation.

I know that C++ would be better in this case because of public and private methods and I also have an idea that I can prevent B() being called directly by using some flag check of A() in B() but I want to know if there is any other method so that user cant call my functions (like B()) which are not exposed in header 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-06-14T03:50:00+00:00Added an answer on June 14, 2026 at 3:50 am

    Make function B:

    static void B(void)
    {
      //some code here
    }
    

    Its visibility will be limited to the translation unit where it is defined. B will have internal linkage; A will have external linkage.

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

Sidebar

Related Questions

When writing a library or the public API of a module that will be
I'm developing a small OOP/RAII library that wraps Win32's mixerXXX API functions. I'm writing
I am writing a small program in C++ using OpenCV-2.3 API. I have an
I am writing a small e-shop application with Symfony 2 and I need some
I'm writing some C# bindings for the C library controlling the pulseaudio sound server,
I am writing a C++ wrapper around a legacy API. This API provides me
I'm writing a small application which exposes a simple REST-ish HTTP API. I'm stuck
I'm writing a small java program that will detect a QR code in a
I am new to network programming, and have been learning this by writing small
I'm writing a small application for Windows 7 that will track focused programs and

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.