APIENTRY counterpart in UNIX

I'm trying to call a C program from my COBOL module. I've found a sample code in the net that uses APIENTRY for every function in C that will be access by the COBOL module (i.e. int APIENTRY UpdateFields(char *, char *, int *) ). However, to use this function, windows.h must be included in the list of header files. Does anyone of you know the counterpart of this function in UNIX? Or is it ok if copy the windows.h header in UNIX?

APIENTRY is pure windows only.

MicroFocus COBOL compiles COBOL into C, then uses the C run-time, for example.
You should be able to create an object file like this

cc -c myfile.c

and then add myfile.o to the command line for the COBOL compile. See your compiler doc set, it will explain linking in external object files. You may have to modify the calling parameters for the function(s) you create in C to tell the C compiler how to clean up the stack. Your COBOL doc set will cover all that.

Thanks for the info Jim. However, when I tried to compile my C module without the APIENTRY (i.e. int bmodcheck (char *, char *, ...) ), I get the following errors ->

$ cc bmodcheck.c -o bmodcheck
Undefined first referenced
symbol in file
socket bmodcheck.o
gethostbyname bmodcheck.o
bind bmodcheck.o
sendto bmodcheck.o
inet_ntoa bmodcheck.o
main /opt/app/SUNWspro/WS6U2/lib/crt1.o
recvfrom bmodcheck.o
ld: fatal: Symbol referencing errors. No output written to bmodchek

I guess this has something to do with my C module wihch has no main() function inside. Would you know how I could fix this problem? If I tried to used the APIENTRY (i.e. int APIENTRY bmodcheck (char *, char *, ...) ), I get the following errors:

$ cc CMPCACVN.cbl bmodcheck.c
"./bmodcheck.h", line 11: syntax error before or at: BMODCHK
"./bmodcheck.h", line 31: warning: old-style declaration or incorrect type for:K
"bmodcheck.c", line 41: syntax error before or at: BMODCHK
cc: acomp failed for bmodcheck.c

First off

 cc -c bmodcheck.c 

not cc -o

Second I think you have a windows style .h file. Your errors are in the include file
bmodchk.h. APIENTRY DOES NOT WORK IN UNIX. Remove it. :smiley: