[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon Aug 3 18:01:43 2003 
Subject:Re: Poplog and C under Linux 
From:Aaron Sloman 
Volume-ID:1030803.03 


AdamBell@Connectfree.co.uk writes:

> Date: Sun, 3 Aug 2003 10:06:17 +0000 (UTC)
> ....
> The problem we're having at the moment is simply trying to get poplog and c
> talking to each other on Linux Mandrake 9.0.  I've read the appropriate
> documentation and came up with the following simple c and poplog code (which
> works fine under Unix I'm told):
>
> /*C Code - test.c*/
>
> #include <stdio.h>
>
> int multiply(int x, int y)
> {
>   return (x*y);
> }
>
>
> /*Poplog Code - test.p*/
> ;
> external declare testprog in c;
>     int multiply(x, y)
>     int x, y;
>     {}
> endexternal;
>
> external load testprog;
>   test
> endexternal;
>
> vars a = 5, b = 2;
>
> /**/
>
> With the above code, I'm getting the following error:

You don't say what you did with the test.c program.

I think that on linux cc is the same as gcc

I looked to see what David Young had done to compile his C code for the
popvision library using gcc so that it could be linked into pop11

    http://www.cs.bham.ac.uk/research/poplog/popvision/com/compile_popvision_gcc

It seems that you have to use -shared.

So I tried

    gcc -o test.so -shared test.c

this produced a file test.so, which was requested in your mishap
message.

Then your example worked:

    external declare testprog in c;
        int multiply(x, y)
        int x, y;
        {}
    endexternal;

    external load testprog;
      test
    endexternal;

    multiply(999, 9) =>
    ** 8991


Aaron
====
Aaron Sloman, ( http://www.cs.bham.ac.uk/~axs/ )
School of Computer Science, The University of Birmingham, B15 2TT, UK
EMAIL A.Sloman AT cs.bham.ac.uk   (ReadATas@please !)
PAPERS: http://www.cs.bham.ac.uk/research/cogaff/ (And free book on Philosophy of AI)
FREE TOOLS: http://www.cs.bham.ac.uk/research/poplog/freepoplog.html