My C++ functions for postgres use a parameter (the path to the config) for static singleton Config class, now it is set from Cmake via definitions. I want to make the path specified like an argv parameter in the main function. However, my functions are just a shared (.so) library. Is there any way to achieve such functionality ?
Now I use this vartiant:
add_compile_definitions(CONFIG_PATH="/some/path/to/config.ini)
Also I have sql script for creating postgres functions:
CREATE OR REPLACE FUNCTION some() RETURNS text
AS 'postgres_Clibrary.so', 'someFunction'
LANGUAGE C;
And load functions as:
psql -f create_functions.sql
And I want to change this to something like:
psql -f create_functions.sql -DPATH_TO_CONFIG="/some/path/to/config.ini"
Is there any variant to get similar functionality as I want ? How to do it without recompilation ?