Re: Calling ECLiPSe from C++

From: Joachim Schimpf <j.schimpf_at_icparc.ic.ac.uk>
Date: Thu 30 Jun 2005 01:00:21 PM GMT
Message-ID: <42C3ECE5.9060506@icparc.ic.ac.uk>
Roman Buil wrote:
> Hei,
> 
> I am trying to call ECLiPSe from C++ and I have a problem when I want to
> save the results that I obtain with ECLiPSe in my variables in C++.
> 
> I have defined EC_refs variables to work in ECLiPSe but when they are
> instantiated I need to transform to integers, how could I make that?

If you are using EC_refs, the [] operator returns an EC_word,
from which you can retrieve the value:

	long i;
	EC_refs X(5);

	... do ECLiPSe computation ...

     	if (X[0].is_long(&i) == EC_succeed)
	{
		integer now in i
	}

If you are using a single EC_ref you have to use an EC_word cast:

	long i;
	EC_ref A;

	... do ECLiPSe computation ...

	if (((EC_word)A).is_long(&i) == EC_succeed)
	{
		integer now in i
	}


-- 
  Joachim Schimpf              /             phone: +44 20 7594 8187
  IC-Parc                     /      mailto:J.Schimpf@imperial.ac.uk
  Imperial College London    /    http://www.icparc.ic.ac.uk/eclipse
Received on Thu Jun 30 14:02:16 2005

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