[R-pkg-devel] Virtual C++ functions
Serguei Sokol
@ergue|@@oko| @end|ng |rom gm@||@com
Wed Nov 15 14:54:03 CET 2023
Le 15/11/2023 à 10:37, Michael Meyer via R-package-devel a écrit :
> Greetings,
> Suppose I wanted to develop a package with C++ code that contains virtual functions which the package user should define.It's assumed that evaluation is expensive so we do not want to define these in R and then call these R-functions from C++.
Hm, virtual C++ functions are defined at compilation time. Their binding
is done at runtime but at compilation time they must be already defined.
So, how a package user (who already installed and therefor compiled your
package) could define them? Moreover in R?
Or may be you mean that a user import your C++ code and define his own
derived function based on your virtual functions in his C++ code?
Or, another option, you call "virtual function" what is usually called
"callback function" like e.g. a function searching for roots of any user
defined function and taking it as a parameter. This latter is a callback
function.
Could you precise what you mean by "virtual function" and "package user
should define"?
Best,
Serguei.
> Is this a reasonable idea with a standard solution?Are there packages that do this?
> Thanks in advance for all answers,
>
> Michael Meyer
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-package-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
More information about the R-package-devel
mailing list