Call Strawberry Prolog as OLE server from outside
Warning: This functionality is available ONLY in the Professional edition.

Strawberry Prolog is an OLE server and this give you the possibility to embed it in projects which are made on different language like Visual Basic or Python. Of course, you can call this server also from Strawberry Prolog.

Like a demonstration of this possibilities try the programs which are in the folder OLE / Servers. These programs demonstrate the use of Strawberry Prolog as OLE server. Actually these programs are OLE clients and OLE servers. The Server Name of Strawberry Prolog is "Strawberry.Server.1". You can use the function server in order to open SP as server from SP client program.

In order to start the server program the client has to put the program path in the program property and after this to call the method compile. When this is ready the client can use the method call in order to start evaluation of a predicate but before to call the method call the properties predicate and arguments has to be filled. The predicate must to be the name of one argument predicate from the server program. The property arguments is actually the only argument of the predicate but this argument can be a list of arguments.

If the client wants to receive a return value then the server has to put it in the G_Return variable (this global variable is defined in the ADD file). After that the client can obtain it by the property result. This property is of the type VARIANT and can contain integer, float, string or boolean (true or false) value. If you give to the variable G_Return a term then the property result will return the string in which this term is printed.

If the server program wants to raise an event to its client (i.e. to send some information back to the client) then it has to use the predicate raise_event.

If the client program wants to listen for events from the server then it has to provide a function (class) which will process these events. In order to do this with SP client, open the server with server2 function. The only event which SP server can send to its client is created by the predicate raise_event

You need the Professional edition to call Strawberry Prolog as OLE server. Actually all methods and properties exist also in the Middle and in the Light edition but in this editions the method compile works only with EXE files. This means that the server program has first to be compiled with the professional edition.

See also:
OLE and ActiveX
server
server2
raise_event
. (point)

Examples:
OLE / Servers