We have a project, that consists of a cluster of C source code, a C library and a C++ library. The C++ library is dependent only upon the C library, or at least that is what I am trying to achieve.
There is a component of the C library, called PresetsManager
, containing:
PresetsManager_init(PresetItemId id);
The id-s are allocated manually via an enum
. As such, the file, containing the enumeration resides inside the common source folder, because it is project-specific.
typedef enum {A, B, C, D, INVALID_VALUE=-1} PresetItemId;
This makes the C library dependent upon the project source for compilation. I tried fixing this by moving the type inside the library, and leaving the enumerated constants outside, with different name.
Library:
PresetsManager_init(PresetItemId id);
typedef enum {INVALID_VALUE=-1} PresetItemId;
Project:
typedef enum {A, B, C, D} PresetItemId_value;
So the compilation problem was solved. But now, when querying PresetItemId
's type via Eclipse's "Go to Definition", we no longer are taken to the list of constants, that is inside the project's specific source code.
How can this decoupling be achieved in a proper way?
Aucun commentaire:
Enregistrer un commentaire