Page 1 of 1

How to transfer a domain int_List to a Visual Prolog 7.5 in C ++?

Posted: 25 Sep 2017 8:27
by alex63
How to transfer a domain int_List to a Visual Prolog 7.5 in C ++?

Code: Select all

domains     int_List =node(integer,int_List);nil().     fnak_addKZ_Robot=(string Kz ,int_list Nodes) -> integer procedure language stdcall.
This structure int_list in C++ not equivalent Visual Prolog 7.5.

<pre>typedef struct node {
unsigned char func ;
int val;
struct node *next;
} int_list;

int fnak_addKZ_Robot(wchar_t *kz ,int_list nodes);</pre>

Posted: 25 Sep 2017 20:39
by Thomas Linder Puls
See Functor Domain Layout.

There are no functors in the node's and the empty list is represented by the pointer value 1. It can be declared like this:

<pre>typedef struct node *int_list;

struct node {
int head;
int_list tail;
};

const int_list empty = (int_list)1;</pre>

Also remember the __stdcall in the function declaration:

<pre>extern "C" {
int __stdcall fnak_addKZ_Robot(wchar_t *kz, int_list nodes) {
if (empty == nodes) {
...
} else {
...
}
}
}</pre>

Posted: 26 Sep 2017 19:37
by alex63
It helped. Thank you. :D