gemichael@cytanet.com.cy wrote: > I have been trying (unsuccessfully) to execute a C function from Eclipse. I > compiled file (exporting the function), linked eclipse.lib as required and > ended up with a dll file. The file is loaded ok from eclipse. But when I > try to map the function into a predicate using > > external(func/1, p_func) > > I get the following error: > > External function does not exist in external_(func / 1, p_func, eclipse) [...] Loizos Michael eventually tracked this down to p_func being a C function in a C++ file without being declared as `extern "C"' --- hence the C++ compiler was mangling its name. For anybody else trying to get started using external C functions from ECLiPSe code, I thought I'd post the set of "this worked for me" instructions that I sent to Michael, for getting a simple example up and running using Microsoft Visual C++ 5. These instructions complement the content of the Embedding and Interfacing Manual. - Create a new work space (if desired). - Create a new Win32 Dynamic-Link Library project using the name you wish the DLL to have, in this work space. - Add to this project the C/C++ files containing the C functions you wish to be able to call from ECLiPSe. - If you're just using `extern' to export the functions (rather than `__declspec(dllexport)' or whatever), then create an appropriate .def file and add it to the project (see the MSVC++ documentation for more information about this). - In the link settings for this project add eclipse.lib to the list of object/library modules (e.g. at the start). - In the Options dialog box from the Tools menu, select the Directories tab and add the include/i386_nt and lib/i386_nt directories from the installed version of ECLiPSe to the include files and library files lists, respectively (e.g. at the end). - Build the project. - Copy the DLL to somewhere it will be found (e.g. the directory where your ECLiPSe program is --- see the Embedding and Interfacing Manual for other alternatives). You should then be able to load and run your application. Cheers, WarwickReceived on Mon Jan 08 19:23:35 2001
This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:07:07 PM GMT GMT