A Question for you as a user of a Lite-C library or framework.

Suppose the used library has got the modules Engine, Car and Helicopter in normal Header and Source file implementation.
Now Car and Helicopter uses Engine and calls Engine functions which should be defined in the header file because they are used by Car, Helicopter and maybe other vehicles (provided by the library) in future.
But the client which will use the Car module and Helicopter module should NOT use the Engine module.

Code:
Engine.h

struct {
    int rpm;
} Engine;

Engine_setRpm (Engine* this, int rpm);


--------------
Car.h

struct {
   . . .
   Engine* engine;
   int tireTemp;
} Car;

Car_accelerate(Car* this, int value);


--------------
Helicopter.h

struct {
   . . .
   Engine* engine;
   int altitude;
} Helicopter;

Helicopter_gotoAltitude(Helicopter* this, int value);




Now my question is what would you like to see in a library:

A) Function name which indicates that this function should never be used outside the library itself

Library_Engine_LibInternal_setRpm (Engine* this, int rpm);


B) leave the function name unchanged and add a comment

/*
Private
Do not use this function if you are a client of the framework and if you do not implement new features for the framework.
*/
Library_Engine_setRpm (Engine* this, int rpm);


C) Separate free to use by client modules and internal modules

vehicles/internal/engine.h
vehicles/helicopter.h
vehicles/car.h

Which maybe get a little messy over time when the library grows I suppose?



What are your methods to write/structure your code so that it is best protected by accidently using internal implementations which are not intended to use by client.
I am looking forward to hear how you implement your Lite-C Work or what you’d like to see in a Lite-C library considering the mentioned problem.

Last edited by nekokuruma; 06/03/15 14:53.