Quantcast
Channel: Visual COBOL - Forum - Recent Threads
Viewing all articles
Browse latest Browse all 1559

Problem calling C program

$
0
0

Environment is 64-bit AIX, Visual COBOL 2.1 but compiling on the command line.

I have a simple COBOL program calling a simple C program. The COBOL program is compiled as 64-bit. The C program is, as far as I am aware, compiled as 64-bit - I have used the compilation option -maix64 and the loader option -b64. Running the program generates the error "253 Cannot load file - unsupported format". I have also tried compiling the COBOL program as 32-bit but with the same result. A previous question in the forum about this same result was apparently due to a 64-bit COBOL program calling a 32-bit C program, but I think I've eliminated that.

To eliminate anything else, I edited the two programs down to absolute basics (the return 19 in the C program is so I can check that a value is definitely being returned):

       program-id.                     testc.

       special-names.

           call-convention 0 is aix-c.

       working-storage section.

       01  ws-name                     pic x(4) value "fred".

       01  ws-return-val               pic s9(9) comp-5.

       procedure division.

       a-control section.

           move zero                   to ws-return-val

           call aix-c "helloworld"     using ws-name
                                       returning ws-return-val

           display "Returned " ws-return-val

           goback
           .

#include <stdio.h>

int
main( int argc, char **argv )
{

printf( "Hello %s\n", argv[1] );

return( 19 );

}


So have I missed something blindingly obvious?


Viewing all articles
Browse latest Browse all 1559

Trending Articles



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