Previous Topic Next topic Print topic


Creating a Sharable Library

Open PL/I can be used to create sharable libraries on any of the following operating systems:

To produce code that can be included in a sharable library, other than on AIX, you must ask Open PL/I to produce position-independent code by using the -pic option. The -pic option is not required for AIX, because all Open PL/I code on AIX is position-independent. Once you have object files generated as position-independent code, you link them into a sharable library using the commands listed below. You also need to link in dllmain.o.

Note: If you intend to use your shared object as an executable program under Enterprise Server it is important to note that your PLI "MAIN" proc needs to have the same name as the shared object or Enterprise Server will not load the .so.

On Solaris 2 or UNIX SVR4:

ld -G -o NEWSHARE.so newshare.o x1.o x2.o x3.o  $MFPLI_PRODUCT_DIR/lib/dllmain.o $MFPLI_PRODUCT_DIR/lib/noofm.o $MFPLI_PRODUCT_DIR/lib/nojw.o -lmf -L$MFPLI_PRODUCT_DIR/lib

On AIX:

ld -o NEWSHARE.so newshare.o x1.o x2.o x3.o -bE:newshare.exp -bM:SRE -brtl $MFPLI_PRODUCT_DIR/lib/dllmain.o $MFPLI_PRODUCT_DIR/lib/noofm.o $MFPLI_PRODUCT_DIR/lib/nojw.o -lmfnso -L$MFPLI_PRODUCT_DIR/lib                                                  

You need to add MFOPENPLIINIT and MFOPENPLITERM to the export file

On Red Hat and SUSE Linux:

ld -shared -o NEWSHARE.so newshare.o x1.o x2.o x3.o $MFPLI_PRODUCT_DIR/lib/dllmain.o $MFPLI_PRODUCT_DIR/lib/noofm.o $MFPLI_PRODUCT_DIR/lib/nojw.o -melf_i386 -lmf -L$MFPLI_PRODUCT_DIR/lib
Note: You need the -melf_i386 command only if building on a 64-bit Red Hat or SUSE Linux.
Previous Topic Next topic Print topic