我试图在iOS应用程序中使用Berkeley的SPICE工具,但是在编译iOS时遇到了问题.
这是一个命令行程序,我可以从终端调用,如:
./spice3f5 <arguments>
Run Code Online (Sandbox Code Playgroud)
哪个效果很好,我想在我的iOS应用程序中使用此功能,但我认为我不能将可执行文件复制到Xcode并从Swift调用它.
我做了一些研究,发现了以下内容:
我在这里问的原因是因为在搜索"ngspice iOS"时,我遇到了这个线程,其中有很多聪明的人试图编译静态库,这似乎超出了我的范围.我了解到iOS8允许动态库.那么编译*.dylib会比静态库更容易吗?
我如何在iOS应用程序中使用ngspice或SPICE?
谢谢
我应该如何从Swift文件中调用C++函数(不涉及类)?我试过这个:
在someCFunction.c中:
void someCFunction() {
printf("Inside the C function\n");
}
void aWrapper() {
someCplusplusFunction();
}
Run Code Online (Sandbox Code Playgroud)
在someCpluplusfunction.cpp中:
void someCplusplusFunction() {
printf("Inside the C++ function");
}
Run Code Online (Sandbox Code Playgroud)
在main.swift中:
someCFunction();
aWrapper();
Run Code Online (Sandbox Code Playgroud)
在Bridging-Header.h中:
#import "someCFunction.h"
#import "someCplusplusFunction.h"
Run Code Online (Sandbox Code Playgroud)
我发现这个答案非常有用,但我仍然无法使其发挥作用.你能指出我正确的方向吗?
谢谢!
我正在玩lldb,我正在尝试调用我的快速静态函数。我能够在图像中找到它的详细信息,但是我不知道如何调用它并传递参数。
我的输出:
(lldb) image lookup -vs $S5project19ViewControllerUtilsC07setRootbC010storyboard13withAnimationySo12UIStoryboardC_SbtFZ
1 symbols match '$S5project19ViewControllerUtilsC07setRootbC010storyboard13withAnimationySo12UIStoryboardC_SbtFZ' in /Users/user/Library/Developer/CoreSimulator/Devices/DC7A5199-424E-4E38-A8A8-CB99C7D8CF82/data/Containers/Bundle/Application/BE7BB249-DB64-4228-B64E-EB430BCCE29E/project.app/project:
Address: project[0x00000002000fc970] (project.__TEXT.__text + 1027840)
Summary: project`static project.ViewControllerUtils.setRootViewController(storyboard: __C.UIStoryboard, withAnimation: Swift.Bool) -> () at ViewControllerUtils.swift:7
Module: file = "/Users/user/Library/Developer/CoreSimulator/Devices/DC7A5199-424E-4E38-A8A8-CB99C7D8CF82/data/Containers/Bundle/Application/BE7BB249-DB64-4228-B64E-EB430BCCE29E/project.app/project", arch = "x86_64"
CompileUnit: id = {0x00000000}, file = "/Users/user/mobile/company/iOS/project/project/Utils/ViewControllerUtils.swift", language = "swift"
Function: id = {0x7700000075}, name = "static project.ViewControllerUtils.setRootViewController(storyboard: __C.UIStoryboard, withAnimation: Swift.Bool) -> ()", mangled = "$S5project19ViewControllerUtilsC07setRootbC010storyboard13withAnimationySo12UIStoryboardC_SbtFZ", range = [0x000000010bd0c780-0x000000010bd0c82e)
FuncType: id = {0x7700000075}, byte-size = 8, decl = ViewControllerUtils.swift:7, compiler_type = "(UIKit.UIStoryboard, Swift.Bool) …Run Code Online (Sandbox Code Playgroud)