[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [open-cobol-list] Problem calling a known void function

From: Ehud Karni
Subject: Re: [open-cobol-list] Problem calling a known void function
Date: Wed, 27 May 2009 17:17:50 +0300

On Wed, 27 May 2009 12:39:21 Roger While wrote:
> Use COBOL syntax for doing this -
>         identification division.
>         program-id. test-free.
>         data        division.
>         working-storage section.
>         01 rec pic x(100) BASED.
>         procedure  division.
>             ALLOCATE rec.
>             move "123" to rec.
>             display rec.
>             FREE rec.
>             move 0 to return-code
>             stop run.

Thank you for your quick answer. We will look into it and use the COBOL
syntax, but for now (while migrating) we have reasons to keep it the
way it is. We have found a general workaround (e.g. for `srandom'):

Create a header file "void_fix.h" like this:

#define free dummy_free
#define srandom dummy_srandom
#include <stdlib.h>
#undef free
#undef srandom
/* the open-cobol compilation works even without prototype */
int free (void *ptr) ;
int srandom (unsigned int seed) ;

and for compilation do:

COB_CFLAGS="-include $CWD/void_fix.h"
....compile as before....


 Ehud Karni           Tel: +972-3-7966-561  /"\
 Mivtach - Simon      Fax: +972-3-7966-667  \ /  ASCII Ribbon Campaign
 Insurance agencies   (USA) voice mail and   X   Against   HTML   Mail  FAX:  1-815-5509341  / \
 GnuPG: 98EA398D <>    Better Safe Than Sorry

reply via email to

[Prev in Thread] Current Thread [Next in Thread]