On 12/24/25 6:48 PM, andy pugh wrote:
I could put all of both source files in the same file, with a massive #IF
Or, maybe I could have both files present and symlink one or the other
depending on the libgpiod version.
Thoughts?

Make sure autoconf/configure/config.h has an entry about which version is being detected/used.

Then change the current source file into a wrapper that will #include the appropriate source for v2/v3. It is not a nice way; #including source files containing actual code is very, very ugly.

A better alternative is to add two source/object files to the Makefile, one for V2 and the other for V3 with same internal API. Then use an all encompassing "#if V2" in one file and "#if v3" in the other. Both will always be linked, but one will be empty after compile, which should be allowed. This may be a cleaner and simpler way to differentiate. If the compiler/linker is stupid, then you can use a dummy variable in each to ensure the unused version's object file is not empty.

--
Greetings Bertho

(disclaimers are disclaimed)



_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to