跨平台的C ++函数到APL [英] Cross-platforming C++ functions to APL

查看:122
本文介绍了跨平台的C ++函数到APL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在为APL编写C ++程序.到目前为止,我一直在做的是在APL中创建一个函数,该函数运行命令提示符并调用可执行文件,并将其创建的输入和输出文件作为参数,然后对C ++可执行文件进行编程以打开输入文件,读取输入并将输出存储在输出文件中,该文件由APL函数获取并存储在一个或多个变量中.这种方法的问题在于,当我使用更简单的函数(有时会被多次调用或有时被递归调用)时,为了进行简单的计算而一直打开和关闭文件会占用大量的处理时间.我试图找到的是一种从解决方案或库中调用用C ++编写的函数的方法,然后直接在我的APL工作区中使用它.

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.

例如,我有一个C ++函数,其编写形式如下:

For example I have a function in C++ written in this form:

Xadd(int x, int y);

,并希望像Xadd (x) (y)这样用APL编写它,并且以后可以使用∇Xadd通过APL打开它.谢谢.

and want to write it in APL like this Xadd (x) (y) and be able to later open it through APL using ∇Xadd. Thanks.

推荐答案

我将首先使用单个入口点在DLL中编译Xadd函数,然后尝试使用[] NA.一个有用的垫脚石可能是首先在Excel(或Word或任何其他使用VBA的MS Office应用程序)中使用VBA进行DLL调用,然后再进行APL.

I would first compile the Xadd function in a DLL with a single entry point, then experiment with []NA. A helpful stepping stone might be to first get the DLL call working with VBA in Excel (or Word or any other MS Office application which uses VBA), then move on to APL.

这篇关于跨平台的C ++函数到APL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆