I’m not sure if this is a bug or a feature, but I noticed the following behavior:
I have a declaration of a function , with no body. I set it to use an external function pointer using addGlobalMapping. This works fine.
Later, I clone the function – and the cloned function doesn’t have the global mapping.
I realize that the global mapping is a part of the execution engine, and not of the module or of the function. As such it is not cloned when the module or function do. However, this is not what I would expect by cloning – I would expect to get the same behavior from the clone.
Is there a reason not to clone the mapping as well? Or a way to set a function pointer that will be cloned?