Re: Eclipse External Language Interface (C)

From: Warwick Harvey <wh_at_icparc.ic.ac.uk>
Date: Mon 08 Jan 2001 06:38:40 PM GMT
Message-ID: <3A5A0930.788F9C71@icparc.ic.ac.uk>
Hi,

gemichael@cytanet.com.cy wrote:
> I finally made it. The actual problem was that the C file had a .cpp
> extension and thus the compiler compiled a C++ file and not a C file.
> I solved the problem by separating the C functions from the C++
> methods into two files. I am really sorry for the trouble.

If you declare the function to be `extern "C"', then it should work OK
even if it's in a C++ file --- otherwise, as you discovered, the C++
compiler mangles the name.

> But, now a new problem has risen. The linken cannot find the pword,
> remember and cut_external declerations. It compiles ok, but it does
> not link. Where are the declarations of these macros, so I can link
> them to my project?

`pword' is a type, not a variable, macro or function, so that name
should not exist any more at link time.  If it does, it must be being
used as a variable or function somewhere in your code.  I'm not sure the
best way to track this down under Windows --- are there tools for
examining the contents of object files?  Anyway, it's probably being
mistakenly used as a function somewhere.  In this case, your compiler
should be able to generate warnings for you whenever you call a function
without declaring it first.

Joachim tells me that `ec_remember' and `cut_external' are rather old,
obsolete functions (they disappeared from the documentation with ECLiPSe
version 3.7), and are not supported any more (hence they're not exported
from the DLL).  Presumably this is some legacy code you're trying to get
working?  It is recommended that you avoid trying to introduce or remove
choice points in C code.  You should be able to transform the code in
question so that the choice points are introduced and cut at the Prolog
level, keeping the C code (semi-)deterministic.

If you can't see how to do this, please let me know what you're using
the remember and cut_external functions for, and I'll try to give you
some pointers.

Cheers,
Warwick
Received on Mon Jan 08 18:38:41 2001

This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:08:03 PM GMT GMT