as/400 ILE 允许将不同语言的过程编译成模块,然后绑定(bind)在一起形成单个程序。我正在尝试使用一个包含从我的 CL 模块(即入口模块)调用的 C 函数的模块来完成此任务。
C 模块源码: mylib/myfile/csource
int getValue(void){
return 20;
}
CL 模块源:mylib/myfile/clsource
pgm
dcl var(&NUM) type(*INT)
callprc prc(getValue) rtnval(&NUM) /* <== Calling C function. */
endpgm
然后我将每个文件编译到它们自己的模块中。
crtcmod module(cmodule) srcfile(myfile) srcmbr(csource)
crtclmod module(clmodule) srcfile(myfile) srcmbr(clsource)
这两个编译没问题。 只是,当我尝试从这两个模块创建程序时,ILE 绑定(bind)器提示 CL 源中的函数 getValue 未定义,并且程序创建失败。
crtpgm pgm(mypgm) module(clmodule cmodule) entmod(clmodule) detail(*basic)
crtpgm 给我的错误:
Unresolved references........................: 1
Symbol Type Library Object Linked Name
*MODULE mylib clmodule *YES getValue
我错过了什么?
最佳答案
CL 语言不区分大小写...
实际上,CL 中不带引号的字符串是隐式大写的。
但是,C 区分大小写。您需要引用过程名称
callprc prc('getValue') rtnval(&NUM)
关于module - 作为/400 : call C procedure from CL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39279997/