geogram icon indicating copy to clipboard operation
geogram copied to clipboard

Use different namespaces for each PSM

Open jdumas opened this issue 2 years ago • 3 comments

Ideally each PSM should use different root namespaces to avoid symbol collisions between them. E.g. GEO_Delaunay or GEO_Predicates instead of simply GEO.

jdumas avatar Mar 01 '23 18:03 jdumas

You mean you want to be able to use both Delaunay_PSM and Predicates_PSM in the same project ? But when you drag Delaunay_PSM, it also has the predicates, so maybe it is just a question of keeping the declarations of the predicates in the .h of the PSM ? (or maybe I did not understand the use case).

BrunoLevy avatar Mar 02 '23 22:03 BrunoLevy

It's really about dependency management and whether each "PSM" should be considered to be a separate entity unrelated to the main "Geogram" library.

Let's say I have two lib A and B. The first one uses the Delaunay_PSM, and will thus look for an #include <Delaunay_psm.h>. The second one only requires the Geogram predicates, and will thus do an #include <Predicates_psm.h>. Right now I wouldn't be able to compile an app that depends on both A and B, since they use different dependencies with conflicting symbols (everything is in the GEO namespace). Even if I linked both A and B against the full Geogram library, they'd be looking for different headers, so it wouldn't compile easily.

My suggested solution would be to consider each PSM as a different library, using different namespaces, so they could coexist with each other inside the same application.

jdumas avatar Mar 02 '23 22:03 jdumas

Thank you for the clarification !

BrunoLevy avatar Mar 02 '23 22:03 BrunoLevy