No, you don’t declare the callable programs like that, but the callable program variables, which you want to call. I would also recommend using a different name (e.g. “func_var”) for the variable than for the function you want to assign to the variable. Don’t know, if this may cause problems, if the names clash.
The example uses
const float3 without the reference, I don’t know, whether references are allowed. Maybe worth a try providing the vCoord by value instead, if everything else fails.
In your .cpp code, you should assign the program for
funcname to the OptiX variable
func_var in the scope depending on your requirements (see https://raytracing-docs.nvidia.com/optix6/guide_6_5/index.html#programs#program-variable-scoping). For example, for a closest hit program, you could set the variable in the Material object like shown for the callable program variable “shader_normal” and the callable program “shade_from_normal” above (Optix 6.5 error).
If you are already doing this and still getting the “Variable “Unresolved reference to variable ExternalTrace from _Z11SceneLaunchv” not found in scope” error, please show me the code, where you assign the callable program variable “ExternalTrace” which you declared with rtDeclareVariable.