1,ILE C调用ILE RPG
PGMC:
#include
#pragma linkage(PGMRPG,OS,nowiden)
int main(int argc, char **argv)
{
char *parm1;
char *parm2;
printf("nC program n");
parm1 = argv??(1??);
parm2 = argv??(2??);
printf(" nparm1 = %s n", parm1 );
printf(" nparm2 = %s n", parm2 );
PGMRPG(parm1,parm2);
return;
}
PGMRPG:
D parm1 S 10A
D parm2 S 10A
C *ENTRY PLIST
C PARM parm1
C PARM parm2
C 'RPG program' dsply
C 'parm1 =' dsply
C parm1 dsply
C 'parm2 =' dsply
C parm2 dsply
C eval *inlr=*on
2,ILE RPG调用ILE C
①ILE RPG调用函数方法:
H BNDDIR('QC2LE') DFTACTGRP(*NO)
D LOG10 PR 8F EXTPROC('log10')
D input 8F Value
D SP1 S 8P 0
D SP2 S 8P 0
C*
C Z-ADD 10 SP1
C EVAL SP2=LOG10(SP1)
C SP1 dsply
C SP2 dsply
C*
C eval *inlr=*on
C RETURN
②ILE RPG调用ILE C方法:
PGMRPG3:
H DEBUG
D SP1 S 8P 2 INZ(0) EXPORT
D SP2 S 8P 5 INZ(0) EXPORT
C*
C Z-ADD 10 SP1
C CALLB 'PGMC'
C SP1 dsply
C SP2 dsply
C*
C eval *inlr=*on
C RETURN
TEST01C:
#include
#include
#include
extern decimal(8,2) SP1;
extern decimal(8,5) SP2;
void PGMC()
{
SP2 = log10(SP1);
}
CRTRPGMOD MODULE(ZYF/PGMRPG3) SRCFILE(ZYF/QRPGSRC)
CRTCMOD MODULE(ZYF/TEST01C) SRCFILE(ZYF/QCLPSRC)
CRTPGM PGM(ZYF/PGMRPG3) MODULE(ZYF/PGMRPG3 ZYF/TEST01C)
阅读(1975) | 评论(0) | 转发(1) |