Discussion in 'C' started by ronald, Jun 15, 2009.
does anyone know the equivalent data type in cobol for const char* var in C?
Which version of Cobol are you using (i.e. what compiler - include full details inc full version number and all that)?
Microfocus 3.1 and I'm trying from Cobol to call a C++ dll which has a function with the following paramaters:
const char *sDatabaseName.
Please note that the calling itself is ok (return no error). however, the error occurs at the end of the cobol program.
the following is the error:
114 attempt to access item beyond bounds of memory (signal 11).
If I tried to call only on char *sSQL (without const char *sDatabaseName) then it works.
Going by the variable names they both look like input variables (i.e. input to the DLL function). What does the function do with results?
The two variables will be represented the same way in the Cobol program; you can treat both as just char* and ignore the const. Const is just a contract that means the string won't be modified.
Can you reproduce the problem with a short Cobol program (say 10 lines or so in the PROCEDURE DIVISION)?
That can't be caused by a missing const. Your program might be trying to access array index(es) beyond its size.
Could you please post your code.
BTW, const char * is nothing special. It's just the same char *. The only thing the const keyword does it, it makes the target func aware that it should not alter the char *.
Separate names with a comma.