aganm
aganm

Reputation: 1369

as/400: call C procedure from CL

The as/400 ILE allows procedures from different languages to be compiled into modules, then bound together to make a single program. I'm trying to accomplish this with a module containing a C function being called from my CL module which is the entry module.

The C module source: mylib/myfile/csource

int getValue(void){
    return 20;
}

The CL module source: mylib/myfile/clsource

pgm
dcl var(&NUM) type(*INT)
callprc prc(getValue) rtnval(&NUM) /* <== Calling C function. */
endpgm

Then I compile each file into their own module.

crtcmod module(cmodule) srcfile(myfile) srcmbr(csource)
crtclmod module(clmodule) srcfile(myfile) srcmbr(clsource)

These two compile, no problem. Only, when I try to create a program from these two modules, the ILE binder complains that the function getValue in the CL source is undefined and the program creation fails.

crtpgm pgm(mypgm) module(clmodule cmodule) entmod(clmodule) detail(*basic)

The error that crtpgm gives me:

Unresolved references........................: 1

Symbol    Type        Library        Object        Linked        Name
          *MODULE     mylib          clmodule      *YES          getValue

What am I missing?

Upvotes: 2

Views: 870

Answers (1)

Charles
Charles

Reputation: 23823

The CL language is case insensitive...

Actually, an unquoted string in CL is implicitly upper-cased.

However, C is case sensitive. You'll need to quote the procedure name

callprc prc('getValue') rtnval(&NUM)

Upvotes: 5

Related Questions