I am currently writing C++ programs for APL. Up to now, what I've been doing is creating a function in APL, which runs the command prompt and calls the executable, with input and output files it creates as parameters and in turn, the C++ executable is programmed to open the input file, read the input and store the output in the output file, which is fetched by the APL function and stored in one or more variables. The problem with this method is that, when I use simpler functions which will be called a lot or sometimes recursively, opening and closing files all the time for a simple computation take up a lot of the processing time. What I am trying to find out is a way to call a function that is written in C++, either from a solution or a library, and use it directly in my APL workspace.
For example I have a function in C++ written in this form:
Xadd(int x, int y);
and want to write it in APL like this Xadd (x) (y)
and be able to later open it through APL using ∇Xadd
. Thanks.