gpt4 book ai didi

c++ - 从单个 *.cc* 源文件生成多个 *.oct* 文件以将 C 库连接到 Octave

转载 作者:太空狗 更新时间:2023-10-29 19:47:36 25 4
gpt4 key购买 nike

我有一个 C 库,我想在 Octave 中使用它.关注tutorial ,这似乎很简单:用 C++ 包装函数,然后 mkoctfile 它们。问题是:如果我想在单个源文件中有多个函数定义(包装器)怎么办?

在提到的教程中说明

It should be noted that it is perfectly acceptable to have more than one DEFUN_DLD function in a source file. However, there must either be a symbolic link to the oct-file for each of the functions defined in the source code with the DEFUN_DLD macro or the autoload (Function Files) function should be used.

然后在提供的链接中:

Once Octave finds a file with a name that matches (the called function), the contents of the file are read. If it defines a single function, it is compiled and executed. See Script Files, for more information about how you can define more than one function in a single file.

在第二个链接中,没有关于如何加载包含多个函数的 .oct 文件或如何从一个文件生成多个 .oct 文件的信息单一源文件。据我了解,后者是正确的方法。我该怎么做?

最佳答案

第二个链接的要点是您不要加载一个包含多个函数的.oct 文件——至少从octave 的角度来看是这样。这就是符号链接(symbolic link)的用途 - 你有符号 ABC 吗?制作指向该文件的 A.octB.octC.oct 符号链接(symbolic link),您可以像使用它们一样使用它们只有您关心的符号。

关于c++ - 从单个 *.cc* 源文件生成多个 *.oct* 文件以将 C 库连接到 Octave,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54224260/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com