Javascript 在js ctypes mozilla插件sdk中使用dll-查看程序';什么是标准?

Javascript 在js ctypes mozilla插件sdk中使用dll-查看程序';什么是标准?,javascript,dll,firefox-addon,firefox-addon-sdk,jsctypes,Javascript,Dll,Firefox Addon,Firefox Addon Sdk,Jsctypes,已编辑,因为我的DLL构建错误: 我已经构建了一个DLL,如果我在DLL上执行dumpbin/exports命令,我会看到以下内容: Dump of file stun_driver.dll File Type: DLL Section contains the following exports for stun_driver.dll 00000000 characteristics 546E6C63 time date stamp Thu Nov 20 17:34:11 2014

已编辑,因为我的DLL构建错误:

我已经构建了一个DLL,如果我在DLL上执行
dumpbin/exports
命令,我会看到以下内容:

Dump of file stun_driver.dll

File Type: DLL

  Section contains the following exports for stun_driver.dll

00000000 characteristics
546E6C63 time date stamp Thu Nov 20 17:34:11 2014
    0.00 version
       1 ordinal base
       4 number of functions
       4 number of names

ordinal hint RVA      name

      1    0 00001005 OPENSSL_Applink = @ILT+0(_OPENSSL_Applink)
      2    1 00001320 launch_stun = @ILT+795(_launch_stun)
      3    2 000011D6 stop_stun = @ILT+465(_stop_stun)
      4    3 00001078 test_print = @ILT+115(_test_print)

  Summary

   1A000 .data
    2000 .idata
   46000 .rdata
    F000 .reloc
  135000 .text
我执行“test_print”函数的代码如下:

/* import js-ctypes */
 Cu.import("resource://gre/modules/ctypes.jsm")
 var stun_driver = ctypes.open("C:\\stun_driver.dll");

const test_print = stun_driver.declare("test_print", ctypes.default_abi, ctypes.int32_t);
.
.
.//in a button
test_print();

所以我的问题是,如果我的
test\u print()
正在执行
printf(“Hello World”)
,那么该文本将显示在哪里?它似乎没有被记录到我的浏览器控制台,也没有记录到我运行“cfx run”的dos控制台。

如果你从终端窗口启动Firefox,你应该在那里看到输出。

这是一个很好的主题:Hrmm。这似乎是在谈论从附加组件运行shell命令,而不是在共享库中运行方法——或者我弄错了?你是对的。要获取dll的输出,您必须使用shell运行它,然后获取shell的输出。查看subprocess.jsm。您可能会发现这很有用:我可以从javascript控制台.log()之类的地方看到终端窗口中的输出,但我似乎看不到来自我的C语言的任何输出program@Derek我认为您必须使用-console命令行选项启动firefox,请参见此处:(我认为这只是windows版)有趣的是,如果我使用它来启动firefox,我可以得到控制台输出。我刚刚发现
cfx
有一个选项
--binary args
,我可以用它将
-console
传递给firefox。这使得终端出现了firefox,但没有得到任何输出。但是,如果我关闭空白终端(关闭firefox),我会看到输出显示在原始终端中,其中包含我的
cfx run