创建ForeignCallback

创建ForeignCallback[如果,类型]

创建具有指定类型的外部回调,可以从外部库调用。

细节

  • 创建ForeignCallback返回托管外国回拨对象。
  • 可能的参数和返回类型及其对应的C类型包括:
  • “无符号整数8”单位8_t无符号8位整数
    “整数8”整数8_t有符号8位整数
    “无符号整数16”单位16_t无符号16位整数
    “整数16”整数16_t带符号16位整数
    “无符号整数32”uint32_t中无符号32位整数
    “整数32”整数32_t带符号32位整数
    “无符号整数64”单位64_t无符号64位整数
    “整数64”整数64_t带符号64位整数
    “CUnsignedChar”无符号字符C兼容的无符号字符
    “CSignedChar”带符号字符C兼容的有符号字符
    “CUnsignedShort”无符号短C兼容无符号短
    “CShort”(短)短的C兼容短款
    “CUnsignedInt”无符号整型C兼容无符号int
    “CInt”(CInt)整数C兼容int
    “CUnsignedLong”无符号长C兼容无符号长
    “CLong”(CLong)长的C兼容长
    “CSizeT”尺寸_tC兼容尺寸_t
    “CFloat”(CFloat)浮动C兼容浮子
    “C双倍”双重的C兼容双
    “不透明原始指针”空隙*不透明指针
    “原始指针”::[t吨]t吨*类型化指针
    {第y天1,第y天2,}结构{第y天1 如果1;第y天2 如果2;}结构或产品类型
    “无效”空隙无输出(仅在输出类型中)

示例

基本示例  (1)

加载接受函数指针的外部函数:

创建外部回调函数:

调用外部函数并传递外部回调:

02
0
12
1
22
4
2
9
42
16
52
25
62
36
72
49
82
64
92
81

读取输出:

Wolfram Research(2023),CreateForeignCallback,Wolfram Language函数,https://reference.wolfram.com/language/ref/CreateForeignCallback.html。

文本

Wolfram Research(2023),CreateForeignCallback,Wolfram Language函数,https://reference.wolfram.com/language/ref/CreateForeignCallback.html。

CMS公司

沃尔夫拉姆语言。2023.“CreateForeignCallback”,Wolfram语言与系统文档中心。Wolfram研究。https://reference.wolfram.com/language/ref/CreateForeignCallback.html。

亚太地区

沃尔夫拉姆语言。(2023). 创建ForeignCallback。Wolfram语言与系统文档中心。检索自https://reference.wolfram.com/language/ref/CreateForeignCallback.html

BibTeX公司

@misc{reference.wolfram_2024_createforeigncallback,author=“wolfram Research”,title=“{createforeigncallback}”,year=“2023”,howpublished=“\url{https://reference.wolfram.com/language/ref/createforeigncallback.html}”,note=[访问时间:2024年6月14日]}

BibLaTeX公司

@在线{reference.wolfram_2024_createforegrewcallback,organization={wolfram Research},title={createforeigncallback},year={2023},url={https://reference.wolfram.com/language/ref/createforeigncallback.html},note=[访问时间:2024年6月14日]}