I am writing a small module of the API library library in C. I will compile this module and pass it on to my fellow developers, and I will lay out some required functions in the header file of my module so that the developers who will use my module know that to call the required functionality . Now I want to find out one thing: can I open only the desired functions in C. for example.
I have test.c having:
#include "test.h" void A() { if( some condition is true ) B(); else return; } void B() {
and in test.h, I have only one function open by ie
void A();
Now B () clearly depends on the condition set in A (), otherwise it cannot be started, and as soon as A () is set to test.h, then the user will not know that he can also directly call B () , Now I'm afraid that if the user finds out (or guesses) that in my module called B () there is a function that can be called directly, bypassing A (), then this may jeopardize my implementation.
I know that C ++ would be better in this case due to public and private methods, and I also have the idea that I can prevent B () from being called directly using some check of the A () flag in B (), but I want to know if there is any other method so that the user cannot call my functions (e.g. B ()) that are not displayed in the header file.
source share