4GL calling c function-memory fault

Asked By 200 points N/A Posted on -
qa-featured

Hello,

I am using IDS 11.50.FC71E on RHEL 2.6.18. I have a 4GL function and it calls the C function using this code:
 
CALL c_func(x, y, z) WHERE x, y and z are the parameters.
 
But it gives a fault (core dump). If I do not pass the parameters, then the program is working fine. Even in HP UNIX, the program works fine even with arguments being passed. Only in RHEL am I facing this issue. Can you please let me know what can be the root cause of the problem and how to solve it?
 
Thanks in advance.

 

 

SHARE
Best Answer by
Answered By 5 points N/A #84907

4GL calling c function-memory fault

qa-featured

You may use this advice to work around this problem:

  1. Install the RPM  as normal value.
  2. Move the RHEL drivers of the way:
  3. Remove vs-tools.for enough space.
  4. Shutdown VM and disable vstools.
  5. Start VM and then reinstall the VI RPM.
  6. Shutdown VM and enable vstools
  7. Start VM and over this problem visit this link.

Thanks.

Best Answer
Best Answer
Answered By points N/A #84908

4GL calling c function-memory fault

qa-featured

Actually this problem is occurring for lying in the popvchar function call. The 4GL function calls the “C” function as well as “len” as arguments. The “C” function calls “popchar(str,len)”; it will be utilized to extract the “str” string of “len” length from the stack.
But here the “len” is variable not passed appropriately as an argument to the “popvchar” function.


More details check Help – IBM.


Both “popquote( )” and “popvchar( )” copy accurately “len” bytes into the string buffer *qv. Here “popquote( )” pads with spaces as needed, but “popvchar( )” doesn’t pad to the full length. The finishing byte copied to the buffer is a null byte to terminate the string, so the maximum string data length is “len-1”. If the loaded argument is longer than “len-1”, its trailing bytes are lost as well it will not save the argument from the stack & memory fault occurs.
So you need to call the “popvchar()” by “popvchar(str,len-1)”.
Hope this will help to fix your issue.
Thanks

Related Questions