From: Vitor S. C. <vs...@gm...> - 2014-06-16 00:30:48
|
Hi Jean-Noel > Davide, I needed exactly what you are looking for so I modified Yap 6.2.2 to put all global variables of Yap into a C++ class, changed functions into methods and modified some code to be correct C++. The result is working well (note that signals are broken since there is now more than one Yap). > > It might be an extension of the work done in the directory CXX in yap-6.3.4 in which I noticed that only one instance of YAPEngine can be created. The problem is I don’t see a clean way to keep together the C code and the C++ code together in order to make C++Yap only an extension of CYap. > Yes, the current interface does not support threads. It is just an initial effort. The best way may be to have a YAPDB class and YAPEngine class, and create an YAP thread that inherits from both. Jean-Noel, why not just have different processes? > Jean-Noël > > > > Le 15 juin 2014 à 14:19, Vitor Santos Costa <vs...@gm...> a écrit : > >> Dear Davide. >> >> Sorry for the delay >> >> >>> is it possible to create multiple prolog interpreters in the same C/C++ >>> program? >> >> Yes, if you have -DTHREADS (or if you use --enable-threads). >> >>> As far as I know, functions such as YAP_FastInit and YAP_RunGoalOnce are >>> global, so I cannot initialize multiple instances. >> >> FastInit will create a single database, thaat will be shared by all >> threads. But threads can run separate, and RunGoal shsould be >> thread-local. Have a look at >> >> YAP_ThreadCreateEngine, YAP_ThreadAttachEngine, >> YAP_ThreadDetachEngine, YAP_ThreadDestroyEngine. YAP also supports the >> thread creation ops in the SWi interface: >> >> PL_thread_self() >> PL_unify_thread_id() >> PL_thread_attach_engine() >> PL_thread_destroy_engine() >> PL_thread_at_exit() >> >> >>> In particular, I'm creating a c++ class that calls yap, so I would like >>> to create a new instance of yap prolog every time I create a new object >>> of the class. Thus every object will call and use yap independently in >>> the same c++ program. >> >> >> You may want to have a look at the directory CXX in yap-6.3.4. It is >> designed to interface with the swig package, but it is growing >> quickly. Any feedback, extensions or patches will be much appreciated! >> >> Vitor >> >>> >>> thanks! >>> >>> regards, >>> Davide >>> >>> Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm >>> >>> ------------------------------------------------------------------------------ >>> HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions >>> Find What Matters Most in Your Big Data with HPCC Systems >>> Open Source. Fast. Scalable. Simple. Ideal for Dirty Data. >>> Leverages Graph Analysis for Fast Processing & Easy Data Exploration >>> http://p.sf.net/sfu/hpccsystems >>> _______________________________________________ >>> Yap-users mailing list >>> Yap...@li... >>> https://lists.sourceforge.net/lists/listinfo/yap-users >> >> ------------------------------------------------------------------------------ >> HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions >> Find What Matters Most in Your Big Data with HPCC Systems >> Open Source. Fast. Scalable. Simple. Ideal for Dirty Data. >> Leverages Graph Analysis for Fast Processing & Easy Data Exploration >> http://p.sf.net/sfu/hpccsystems >> _______________________________________________ >> Yap-users mailing list >> Yap...@li... >> https://lists.sourceforge.net/lists/listinfo/yap-users > |