Hi Kish, I am extending PyCLP by adding the capability to implementing predicates in Python. PyCLP interfaces to Eclipse by using the provided c interface. So for me it is easier to register a new predicate from c instead of posting external/2 and then execute resume. However, in case you will find that the error is in the documentation I can always fall-back to the second solution. Beside this issue I have another issue. In Python, functions are defined at execution time (function are converted in bytecode at runtime) and python functions are not mapped to c functions that I can register to Eclipse. So I have a c proxy function registered as call_python/2. First argument shall be atom matching the name of python function and the second argument is a list that I pass to the python function . This is not a ideal implementation. My preferred solution would be: register all predicates (to be linked to python functions) to the same c function. In this c function I get the functor of invoking predicate e.g. ec_functor() then I can search in a python hash table the right python function and call it using c to python interface functions. I don't expect that my use case justifies an effort in this direction by if you have the opportunity.... :-). Best Regards Oreste Bernardi PS. When it is possible, let me know where is the bug so I can update my library. On 30/11/2012 18:51, Kish Shen wrote: > Hi Oreste, > > As I think Joachim may still be on holiday, I will try and give you > some answer to your question... > > Yes, it does look like if you include eclipse.h, this defines > EC_EMBED, and so ec_external() would not be available for use. > > It is not clear to me that the error is therefore ec_external() should > be moved out of the EC_EMBED ifdef, because I am not sure if > ec_external() was deliberately excluded (or removed, after the manual > was written) from the C/C++ interface, and the error (in this case) > would be mentioning it in the embedding and interface manual. > > The usual way of linking predicates defined in C/C++ is to do it in > the ECLiPSe code via external/2, after the creation of the module for > the ECLiPSe code, but before the use of the external predicate. Using > ec_external() is given as an alternative to doing this in C rather > than ECLiPSe, but it is not clear to me how useful this is, because > the intended usage of the C interface is for ECLiPSe code to be in its > own file, rather than as part of the C program file, so using > external/2 seems the most natural way to include external predicates. > > Do you have a use case for using ec_external(), where you think it > would be useful? > > Cheers, > > Kish > > On 27/11/2012 18:40, Oreste wrote: >> Hi, >> I am working on external predicates implemented in C. >> I have just seen that int ec_external(dident pred, int(*fct)(), dident >> module) definition is not included if EC_EMBED is defined. >> See embed.h. >> >> I guess this is a bug because in the documentation this function is >> declared as part of embedded interface. >> Is this correct ? >> >> Best Regards >> Oreste Bernardi >> >> >> ------------------------------------------------------------------------------ >> >> Monitor your physical, virtual and cloud infrastructure from a single >> web console. Get in-depth insight into apps, servers, databases, vmware, >> SAP, cloud infrastructure, etc. Download 30-day Free Trial. >> Pricing starts from $795 for 25 servers or applications! >> http://p.sf.net/sfu/zoho_dev2dev_nov >> _______________________________________________ >> ECLiPSe-CLP-Users mailing list >> ECLiPSe-CLP-Users_at_lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/eclipse-clp-users >> > >Received on Fri Nov 30 2012 - 20:52:00 CET
This archive was generated by hypermail 2.2.0 : Wed Dec 05 2012 - 06:13:35 CET