Quantcast
Channel: Visual COBOL
Viewing all articles
Browse latest Browse all 5819

Forum Post: RE: Linker flag -U in cob32 or cob64

$
0
0
The 'Dynamically Load Unresolved Reference (-U)' means the entries ( programs ) which were not found at the link step will de dynamically called when the program will be executed. For reference: ( documentation.microfocus.com/.../index.jsp ;resultof=%22%63%6f%62%22%20%22%66%6c%61%67%73%22%20 Micro Focus Developer Micro Focus Visual COBOL 2.3 Update 1 for Eclipse (UNIX) General Reference Command line reference Compiling and Linking from the Command Line cob Flags ) 1. As an example take this HELLO.cbl code: 123456 procedure division.           display ":) Hello World"           call  "BONJOUR" 2. When compiling/linking with 'cob -x HELLO.cbl', you'll get: HELLO.o: In function `HELLO': HELLO.cbl:(.text+0x4b): undefined reference to `BONJOUR' collect2: ld a retourn▒ 1 code d'▒tat d'ex▒cution  ( - OS ld error ) This happens because the ld linker can't resolve the entry point 'BONJOUR'... 3. When compiling/linking with 'cob -z HELLO.cbl', The compilation will be fine. But when executing you'll get cobrun HELLO.so Load error : file 'HELLO.so' error code: 198, pc=0, call=1, seg=0 198     Load failure (BONJOUR) RTS 198 = COBRT198 Load failure (Fatal) ... ( documentation.microfocus.com/.../index.jsp ;resultof=%22%63%6f%62%72%74%22%20%22%31%39%38%22%20 ) 4. When compiling/linking with 'cob -xU HELLO.cbl', you'll get: Cobol program "BONJOUR" undefined. Assuming it will be dynamically loaded. The launch of the linked program will give: HELLO :) Hello World Load error : file 'BONJOUR' error code: 173, pc=0, call=1, seg=0 173     Called program file not found in drive/directory Now have such a BONJOUR.cbl program: BONJOUR.cbl 123456 procedure division.           display ":) Bonjour le monde" that you would compile link this way ( cob -z BONJOUR.cbl ) which creates BONJOUR.so Now, when launching the HELLO program, you'll get: HELLO :) Hello World :) Bonjour le monde See here that the BONJOUR.so library was dynamically called ... 5. As an alternative way to link. Now let's link BONJOUR.cbl this way 'cob -Z BONJOUR.cbl' which will produce libBONJOUR.so and link HELLO.cbl this way 'cob -x -L. -lBONJOUR HELLO.cbl' and run HELLO. You'll get HELLO :) Hello World :) Bonjour le monde Regards Yvon

Viewing all articles
Browse latest Browse all 5819

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>