rendered paste body# Makefile
CC=/usr/local/bin/gcc42/gcc42
ADA=/usr/local/bin/gcc42/gcc42
ADABIND=/usr/local/bin/gcc42/gnatbind
ADALINK=/usr/local/bin/gcc42/gnatlink
all: main
test.o: test.c
${CC} -c -o test.o test.c
main.o: main.adb
${ADA} -c -o main.o main.adb
${ADABIND} main.ali
main.ali: main.o
main: test.o main.ali main.o
${ADALINK} -o main main.ali test.o
clean:
rm -f *.o *.ali main
----------------------------------------------------------------------
-- main.adb
with interfaces.c;
procedure main is
type c_int is new interfaces.c.int;
procedure test(x : c_int; y : c_int; z : c_int; w : c_int);
pragma import(C, test);
begin
test(25, 30, 35, 40);
end main;
----------------------------------------------------------------------
/* test.c */
#include <stdio.h>
void
test(int x, int y, int z, int w)
{
printf("test: %d %d %d %d\n");
}
----------------------------------------------------------------------
$ make
/usr/local/bin/gcc42/gcc42 -c -o test.o test.c
/usr/local/bin/gcc42/gcc42 -c -o main.o main.adb
/usr/local/bin/gcc42/gnatbind main.ali
/usr/local/bin/gcc42/gnatlink -o main main.ali test.o
$ ./main
test: -1077941448 -1077941592 134518336 134551936