[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Tue, 3 Feb 2004 14:45:07 +0000 (UTC) 
Subject:[Fwd: Re: Poplog and C under Linux] 
From:ug57dsm 
Volume-ID: 

In reply to a recent question about using C under pop11, I saved this
message from a while back. This should help.

david.

-------- Original Message --------
Subject: Re: Poplog and C under Linux
Date: Sun, 3 Aug 2003 18:01:43 +0000 (UTC)
From: A.Sloman@cs.bham.ac.uk (Aaron Sloman)
Organization: School of Computer Science, The University of Birmingham
To: pop-forum@cs.bham.ac.uk


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 creates [changed word because mail filter would not accept original 
- DSM] 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




-- 
=================================================
  The future of HTML mail is clearly > /dev/null.
=================================================
  Two of the most famous products of Berkeley are
LSD and Unix. I don t think that is a coincidence
=================================================