Is it possible to access a non exported item from another translation unit?

I have a definition of a function called Mem() inside a C++ 20 module but not exported. I need to access Mem() from another translation unit in the project. Is it possible? I am writing some unit tests and need special access to test internal implementations...

One possibility is conditional exporting but I am looking for something better:

1
2
3
4
5
6
7
#ifdef DOING_UNIT_TESTING
#define EXPORT export
#else
#define EXPORT
#endif

EXPORT void Mem() {}


Topic archived. No new replies allowed.