Why failed in process of Prolog call C call Prolog?

Shuai Wang <[email protected]>
Newsgroups gmane.comp.gnu.prolog.general
Message-ID <CAEQMQokkMVCJqopAGnEsrc702x2RBgN326pZk6ooagd4=MOD5Q@mail.gmail.com>
Hello gnu-prolog users,


On my 64bit x86 Linux,  I am trying to implement this process.

I have two source code, written in C and Prolog.
In the Prolog code, I have two functions foo and foo1.

So basically inside Prolog function foo, it calls function foo1 *through a
C wrapper,* then after function foo1 finished, it will return through
wrapper back to foo

it is something like :

---------------------------------------------------
           Prolog                |         C
---------------------------------------------------

         foo      ----- call ---- >  foo1_wrapper       normal
         foo1    <-----call -----   foo1_wrapper       normal
         foo1   -------return---> foo1_wrapper       normal
         foo     <-----return----   foo1_wrapper       *fail!*


The problem is that, it can never return back to function foo after
foo1_wrapper returns..

I have done several test(printf, write, valgrind and others...), and I am
pretty sure that foo1 returns right value, and foo1_wrapper returns foo1's
return value as well.

I am really confused right now, I should be able to look into the details,
however, I just don't know which way to go...

Has anyone have certain problems like this...?


Best Regards,
Shuai

_______________________________________________
Users-prolog mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/users-prolog
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.