@vvassilev,
In our setup, we do not use the customized interpreter (with our proprietary functions) by itself where one could do .x filename.c
etc. after starting the interpreter. Expecting the end user to type anything extra will not work well.
Anything that a user does not need to know or do is built into the customized interpreter via incorporating the shared library (say, mylib.so) which is built with our functions. The intent is to allow the user to be able to execute their own scripts that invoke our proprietary functions to do their testing easily in addition to executing the test suites we provide.
Consider that (hypothetically) our end users want to test an automotive engine. They want to be able to change the RPM, change the amount of fuel injected, read the engine temperature under various conditions, etc. We provide API functions like set_rpm(), set_fuel_input(). They don’t know what happens inside set_rpm(), set_fuel_input(), etc. But they could write a test script rpm_test.c which would, say, increase the RPM progressively via set_rpm() till the engine explodes or something (bad design) or shuts down safely.
With an interpreter that has set_rpm(), set_fuel_input() etc. loaded through the shared library (mylib.so), they can easily execute rpm_test.c and don’t need the source code for set_rpm().
The only file that a user would execute is rpm_test.c. However, before that, the initialization function I was asking about earlier would crank the engine and maybe do some other safety checks so that the setup is ready for rpm_test.c. The end users don’t need to concern themselves with the details of that.
We provide lots of tests like rpm_test.c in our test suite which assume that the initialization tasks have been performed. Unless initialization is successful, no test can be run.
Currently, I am able to do the following -
cling -l mylib.so rpm_test.c
where rpm_test.c has a function rpm_test() that calls the initialization function built into mylib.so and then calls set_rpm(). But this involves modifying our pre-existing rpm_test.c to first call the initialization function before doing other RPM related testing. That would require a prohibitive amount of code change when nothing actually needs to change in rpm_test.c and other test scripts. We were able to use all those scripts with the custom cint which had a facility to specify an initialization function that would get executed upon invocation of the custom cint.
I hope this explains the requirements somewhat better. I have tried various other things to invoke the initialization function with cling without changing rpm_test.c but have not had success. Please let me know if there is a way to accomplish this with cling without massive code overhaul.
Also, could you please take a look at my earlier post (Jan 31) about the conditions under which I saw core dumps? I provided code examples (file mytest.c) that would help you reproduce the problem.
Thank you.