我的目标是使用C库来构建Web应用程序.
我已经通过使用"SWIG"工具选择了这样做的方法.Swig工具需要三件事
1) .c file which defines all the functions.
2) .i file also called interface file which is creating the
interface to load the APIs wherin I used the extern keyword.
3) APP written in javascript extension (.js file).
Run Code Online (Sandbox Code Playgroud)
我使用SWIG工具编译并运行此应用程序以验证.js文件是否正确.应用程序在XMING X11窗口上运行正常.
在编译时,它创建_wrap.o,.o文件和libFILENAME.so
现在我想在浏览器页面上运行此应用程序.
为此,我使用了webkit杂乱端口,它为我们提供了MxLauncher代码.我正在使用webkit_iweb_view_load_uri(WEBKIT_IWEB_VIEW(view),"filename.html"); 用于加载我的html文件以在我的网页视图上运行该javascript的API.
我正在编译在编译时创建的.so.
错误消息:JS CONSOLE:file:///filename.js:ReferenceError:找不到变量:example
FILENAME.C
int gcd(int x, int y) `enter code here`{
int g;
g = y;
while (x > 0) {
g = x;
x = y % x;
y …Run Code Online (Sandbox Code Playgroud)