External Predicates & Embedding

From: Simon Christensen <christen_at_mail.csse.monash.edu.au>
Date: Tue 09 Aug 2005 12:21:24 PM GMT
Message-ID: <42F89FC4.7040701@mail.csse.monash.edu.au>
I have a problem related to external predicates. I have a predicate 
written in C which I wish to be able to call within ECLiPSe. The problem 
is that I am not in a standalone ECLiPSe environment, rather I am using 
an embeddeding.

My software is a simple visualisation application, built in C. I am 
using an embedded ECLiPSe environment within it to add support for 
various algorithms. The desired ECLiPSe program is in a file (I didn't 
want to have to rewrite the whole thing by composing it using C 
functions), and it is loaded into ECLiPSe by posting a compile goal.

I have a function, p_change_node_colour() which is part of my C program 
and I wish my script to be able to call it at key points in order to 
synchronise the visualisation with the progress in ECLiPSe. The goal was 
some level of animation, so I wanted to be able to see each update as it 
happened.

The problem that arises is that I can find no way of convincing ECLiPSe 
to actually register my external predicate. The usual (and as far as I 
can see, the only documented) way of using external predicates is to 
compile the desired C functions into a shared library, load the library 
into ECLiPSe and register the functions with ECLiPSe using external/2.

Unfortunately, what I know of shared libraries leads me to the 
conclusion that this isn't going to be possible for my application, as 
the predicate in question needs to be able to communicate with other 
parts of my program. I've tried using external/2 to link a predicate to 
the desired function, however my ECLiPSe embedding doesn't like this, 
coughing up an "External function does not exist" error. This is also 
the case if I use external/1 in the script being included, then post the 
external/2 call as a goal.

I'm pretty sure I must be doing something wrong. If it's really not 
possible to do what I'm trying to do, though, I'll have to look into 
other strategies.

Thanks in advance,
--
Simon Christensen
Received on Tue Aug 09 13:29:00 2005

This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:07:39 PM GMT GMT