|
Hello Jevgeni,
Since C uses the library list by default you should be able to make this work
by:
#pragma linkage( PROGA, OS )
void PROGA( ..... );
int main( void )
{
PROGA( .... );
}
Of course, that method presumes you know the program name at compile-time. If
you don't know the program name until run-time then you can use the RSLVSP MI
function to resolve a system pointer to the progam object and then call it
using
a C function pointer.
You would first resolve to the program in the KLIB123 library. If not found
then
resolve to the program in the KAPBASELIB. Once you have a resolved pointer you
can invoke it using the pointer. For example:
#include <rslvsp.mih>
#pragma linkage( KBPGM_T, OS)
typedef void KBPGM_T( void * parm1, void * parm2 );
KBPGM_T * KBPGM;
int main( void )
{
void * parm1, * parm2;
char * program;
char * library;
program = "PROGA";
library = "KLIB123";
/*
** May need an exception handler for MCH3601
** See #pragma exception_handler in C Language Reference
*/
KBPGM = rslvsp( WLI_PGM, program, library, _AUTH_NONE );
if (!KBPGM )
{
library = "KAPBASELIB";
KBPGM = rslvsp( WLI_PGM, program, library, _AUTH_NONE );
}
KBPGM( parm1, parm2 );
}
If you know that a program with the right name will exist in the library list
then you could simply set library to *LIBL before resolving and skip the second
resolve step.
Regards,
Simon Coulter.
--------------------------------------------------------------------
FlyByNight Software AS/400 Technical Specialists
http://www.flybynight.com.au/
Phone: +61 3 9419 0175 Mobile: +61 0411 091 400 /"\
Fax: +61 3 9419 0175 mailto: shc@xxxxxxxxxxxxxxxxx \ /
X
ASCII Ribbon campaign against HTML E-Mail / \
--------------------------------------------------------------------
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com 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.