cmakepp_lang/utilities/call_fxn
- cmakepp_lang/utilities/call_fxn._cpp_call_fxn_guts(fxn2call result)
Performs most of the work for dynamically calling a function.
cpp_call_fxn
is a macro to avoid needing to forward returns. In order to actually call the function we need to write the call to disk. This involves setting a few variables, so in order to avoid contaminating the caller’s namespace we wrap this part ofcpp_call_fxn
in this function,_cpp_call_fxn_guts
._cpp_call_fxn_guts
is not intended to be called from outside ofcpp_call_fxn
.- Parameters:
fxn2call (desc) – The name of the function we are calling.
*args – The arguments to forward to the function.
- cmakepp_lang/utilities/call_fxn.cpp_call_fxn(fxn2call)
Note
This is a macro, and so does not introduce a new scope.
Calls a function who’s name is provided at runtime.
CMake does not allow you to dynamically determine the name of a function. For example one can NOT do
${name_of_fxn}(<args...>)
or any other variation which retrieves part of the function’s name from a variable. Thecpp_call
macro allows us to circumvent this limitation at the cost of some I/O.- Parameters:
fxn2call (desc) – The name of the function to call.
*args – The arguments to forward to the function.
Note
cpp_call_fxn
is a macro to avoid creating a new scope. If a new scope was created it would be necessary to forward returns, which would significantly complicate the implementation.