Page 1 of 1

Howto use windows engines in linux with xboard.

PostPosted: 07 May 2009, 04:26
by Daniel Uranga
I have done an small C/C++ program which prevents wine of being killed when running a windows engine under Xboard. Here the code:
Code: Select all
#include <iostream>
#include <sys/types.h>
#include <sys/signal.h>
#include <sys/wait.h>
#include <cstdlib>
#include <cstring>
using namespace std;

int main ( int argc, char *argv[] )
{
    int     fd[2];
    pid_t   pid_motor;

    if ( argc==1 )
    {
        cout << "You should use: " << argv[0] << " " << "someEngine.exe" << endl;
        return 1;
    }

    signal(SIGINT, SIG_IGN);
    pipe (fd);

    pid_motor = fork();
    if ( pid_motor==0 )
    {
        char ejecutar[255];
        strcpy ( ejecutar, "wine " );
        strncat ( ejecutar, argv[1], 250);
        system (ejecutar);
        sleep (2);
    }
    else
    {
        int estado;
        wait (&estado);
    }
    return 0;
}

Is easy to compile it with gcc. After that simply "./thisProgram windowsEngine.exe".
Hope will be helpful to someone.