Lim Hock-Chai wrote:
I'm trying to create a c prototype for RPG procedure below. I'm not
sure how to do *nopass and varying length field. Can somebody help?
D logECD_STP3... D pr 15 0 D piModuleName like(logReffldSVLOGPF.LGMODULE)
D const D piLocationID like(logReffldSVLOGPF.LGLOCID) D const D piLogMessage like(logReffldSVLOGPF.LGMSG) D const D piByteRcv 10i 0 D options(*nopass :*omit) const D piDataRcv 2048 varying D options(*nopass :*omit) const

For the varying length field, you can use a struct:

typedef struct varying2048
unsigned short l;
char a[2048];
} varying2048_t;

In the C prototype, code ... to represent all the optional parameters.

To get %PARMS to work in the called procedure, you have to use #pragma descriptor.

Something like this:

decimal(15,0) LOGECD_STP3
(const whatever *moduleName,
const whatever *locationId,
const whatever *logmessage,
#pragma descriptor(void LOGECD_STP3(void, void, void));

I would code EXTPROC('logECD_STP3') in the RPG prototype, so the C version could be logECD_STP3. You could also use #pragma map for the C prototype.

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2021 by and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.