OpenCOBOL Forum Index OpenCOBOL
Issue between declared variables in linkage section in callee sub and "real" variables in caller sub | Register To Post |
| Flat | Previous Topic | Next Topic |
| Poster | Thread |
|---|---|
| eraso | Posted on: 2012/2/28 10:42 |
Not too shy to talk ![]() ![]() Joined: 2006/11/22 From: SUTEC - Fontenay sous Bois (France) Posts: 21 |
Re: Issue between declared variables in linkage section in callee sub and "real" variables in caller sub Hello,
Btiffin, thanks for your reply. Well I made a mistake when I wrote the program samples for the problem I encountered in the asset I'm working with (I may repeat myselft but, in french, cela va sans dire mais ca va mieux en le disant). What I wanted to point is around the definition of variables in linkage section and their use in callee sub and the real definition in caller sub. So I wrote two executables PRG1 and PRG3 calling PRG2 as you can see below : (I compiled PRG1 and PRG3 as executable - cobc -x -debug - and PRG2 as shared library - cobc -m -debug) PRG1 : PRG3 : PRG2 : As you can read, if everything goes right, "MOVE DONE" is displayed on console. Everything goes right for PRG3 but for PRG1, the output is : Quote: PROGRAM-ID: PRG1: ENTRY PRG1 This because in PRG1 STR-PRG1 is defined of 2000 bytes long but in the linkage section of PRG2, STR-PRG1 is defined of 16000 bytes long, so the move order in PRG2 translated to memcopy instruction try to copy 16000 bytes, that is more than the real length of STR-PRG1 defined in PRG1, so that's why the exception "Attempt to reference unallocated memory (Signal SIGSEGV)" is risen. So my question is could the problem and the solution may lie between using the cob_module structure and the cob_move function, as when the move action between two variables of different lengths is done by the cob_move function ? |
| Flat | Previous Topic | Next Topic |
| Subject | Poster | Date |
|---|---|---|
| |
eraso | 2012/2/27 17:06 |
| |
btiffin | 2012/2/27 21:25 |
| » |
eraso | 2012/2/28 10:42 |
| |
human | 2012/2/28 11:45 |
| |
eraso | 2012/2/28 13:55 |
| Register To Post | |






