Created On:  2010-03-26

Problem:

We created an application COBOL with a Language C module that call the C fucntion malloc in 32bits mode. This application runs fine.  We tried it in 64-bit module and the following error is displayed:

Execution error : file 'name'

error code: 114, pc=p, call=c, seg=s

Resolution:

In 64bits the Language C module must include the file stdlib.h .

Example

#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
 typedef struct s_resultat { 
  int n_char ;
  int n_line ;
 } Resultat;
void * one_file( arg )
void  *arg;
{
 Resultat * res = ( Resultat *) malloc ( sizeof(Resultat));
 char * filename = ( char *) arg;
/*
 sp2 ( &( res->n_line) , & ( res->n_char ));
*/
 printf(" %d  %d \\n",res->n_line,res->n_char);
 res->n_char = res->n_line = 0;
 pthread_exit (( void *)res);
 return ( void *) res;
}