> ----------------------------------------------------------------------
> 
> message: 1
> date: Wed, 23 Feb 2005 17:41:29 +0100 (GMT-1)
> from: Damir Dezeljin <programing@xxxxxxxx>
> subject: [C400-L] Linking,...
> 
> Hi.
> 
> 
> I'm completely new to AS/400 (OS400) so please don't be too cryptic when
> replaying ;)
 
 
> Can someone explain me some basic concepts about OS400 please. Let say
> that I have three files:
> -     mod1.c
> -     mod2.c
> -     prog.c
> 
> The ÃâËprog.cÃââ contains the ÃâËmain()Ãââ function. I 
> created those
> objects by doing:
> ----
> export Ãââs OUTPUTDIR=mymodule
> system ÃâÅCRTLIB LIB(MYMODULE)
> icc Ãââc mod1.c Ãââo mod1.o
> icc Ãââc mod2.c Ãââo mod2.o
> icc Ãââc prog.c Ãââo prog.o
> ----

I can't make out some of your message, and have never used the product you 
mention, but here goes. . . 

I take it icc is a compiler, the same as the CRTCMOD command.  
        
CRTCMOD MODULE(MOD1)                      
        SRCFILE(*LIBL/QCSRC)             
        SRCMBR(*MODULE)                   
        OPTION(*AGR *SHOWUSR)             
        OPTIMIZE(*NONE)                   
        INLINE(*OFF *N0AUTO 250 2000 *NO) 
        DBGVIEW(*SOURCE)                  
        
CRTCMOD MODULE(MOD2                      
        SRCFILE(*LIBL/QCSRC)             
        SRCMBR(*MODULE)                   
        OPTION(*AGR *SHOWUSR)             
        OPTIMIZE(*NONE)                   
        INLINE(*OFF *N0AUTO 250 2000 *NO) 
        DBGVIEW(*SOURCE)                        

CRTCMOD MODULE(PROG)                     
        SRCFILE(*LIBL/QCSRC)             
        SRCMBR(*MODULE)                   
        OPTION(*AGR *SHOWUSR)             
        OPTIMIZE(*NONE)                   
        INLINE(*OFF *N0AUTO 250 2000 *NO) 
        DBGVIEW(*SOURCE)                  
 
You could then create (bind) your programs thusly:  

CRTPGM PGM(PROG)        
       MODULE(PROG MOD1 MOD2)
       ENTMOD(*FIRST)   
       BNDSRVPGM(*NONE)  <- Put any user service programs here 
       BNDDIR(*NONE)     <- Put Binding directories here
       ACTGRP(*CALLER)  
       ALWLIBUPD(*YES)  

> My sources are dependant of apr_pool, apr_strings, apr_poll, apr_file,
> apr_utils_queue. I guess that mostly of those objects are collected in
> following BIDDIRs:
> ----
> /QSYS.LIB/QHTTPSVR.LIB/QZSRAPR.BNDDIR
> /QSYS.LIB/QHTTPSVR.LIB/QZSRCORE.BNDDIR
> /QSYS.LIB/QHTTPSVR.LIB/QZSRSDBM.BNDDIR
> /QSYS.LIB/QHTTPSVR.LIB/QZSRXMLP.BNDDIR
> ----


> How can I check what is included in e.g. QZSRAPR.BNDDIR Ãââ I tried to 
> use
> ÃâËDSPBNDDIR BNDDIR(QHTTPSVR/QZSRSDBM)Ãââ from the MAIN MENU, however
> nothing was displayed.

Either there are no binding entries in it, or you may not have permission to 
see.  If the BNDDIR didn't exist then you'd get an error.

 
> I tried to link the above code with:
> ----
> icc -v -qBNDSRVPGM="QHTTPSVR/QZSRXMLP QHTTPSVR/QZSRSDBM QHTTPSVR/QZSRCORE
> QHTTPSVR/QZSRAPR" mod1.o mod2.o prog.o Ãââo prog
> ----

See the CRTPGM command above

 
> Unfortunately not all objects are resolved (e.g. the 
> ÃâËapr_queue_termÃââ
> canÃâât be found). Does anyone have a clue what to do? :)

No.  I'm not familiar with what icc does for you and what it doesn't.
 
 
> Additionally can someone please provide an example how to create a BNDDIR
> from mod1.o and mod2.o? 

A binding directory is a list of objects and where to look for them.  Sort-of 
like a PATH.  You CRTBNDDIR to create a binding directory, then ADDBNDDIRE to 
add object entries to it.  I believe what you are thinking of is a *SRVPGM 
(Service Program)  NOTE:  A *SRVPGM is a DLL, not a real 'program'.  Don't ask 
why they called it a 'SERVICE PROGRAM, unless it is because it provides 
'services' to programs. . . 

> Will mod*.o objects be linked ÃâËdynamicalyÃââ in such a case (bind 
> at
> runtime)?

Not using a binding directory.  To get a static BIND you specify the *MODULE on 
the CRTPGM command or in the BNDDIR.  To get dynamic binding you put the 
*MODULEs into a *SRVPGM, then specify the *SRVPGM on the CRTPGM command or in 
the BNDDIR.  (In either case, if the object is in the BNDDIR you can specify 
the BNDDIR on the CRTPGM command and the system will find what it needs.  (Do 
not put both the modules and the service program you put them into in the 
BNDDIR.  You will get dup definition errors, and the system will bind to the 
resource it finds first.))  Using the CRTPGM command the system will add the 
required system BNDDIRs, you do not need to specify them yourself.

SEE ALSO:  DSPPGM, DSPMOD, DSPSRVPGM

 
> Any hint / link / example, Ãâ - anything) would be really helpful for me.

Hope this is helpful. 


This thread ...


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

This mailing list archive is Copyright 1997-2019 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 here. If you have questions about this, please contact [javascript protected email address].