Hi all, A few weeks ago we sent the following message to the Wine newsgroup at Usenet and we were told that it was better to send it here, so here it goes:
We are trying to port an application from Windows to Linux. This application is clearly divided in two parts: the first one is the graphic interface, which makes an intensive use of COM, MFC, databases and other MS Windows technologies; the second is the application's "kernel" (nothing to do with the Linux kernel), which carries out all the processing. This "kernel" has been created using mostly plain C.
The project needs to be done quite quickly so we've been thinking of using Wine to speed up the process of porting. Thus, we would run the graphic interface using Wine, while we would compile our application's kernel in Linux and it would run as a normal Linux process. In fact we have already managed to run the GUI using wine and it seems to work (more or less). We have compiled most of the kernel too.
The main problem we are facing is communication between the GUI and the kernel. Under Windows we do so by means of shared memory (CreateFileMapping, ...) and we don't know very well how to do it in Linux. We have done some tests with Winelib and it seems like we are getting something.
However, later on we need our kernel to run as a real time task by means of RTAI, and we don't know if that is even possible with Wine/Winelib. Anybody knows if such a thing is possible?
If that's not feasible, I guess we will have to go look how Wineserver works, so we can make our own XXXFileMapping functions to call them from our application's kernel and let us have access to Wineserver's services. But we don't know wether this is posible or if it would be a good solution to our problem.
Another possible solution we've been thinking of is to tweak the Wineserver, so it does the file mapping the way we want (place in memory, format, etc.) and we can read/write it from our application's kernel using plain C functions.
Can anybody help us, please? Which one do you think would be the best solution?
Thank you very much for your help.
______________________________________ Mikel Carrasco I + D Software. Fagor Automation S. Coop. P. O. Box 144 E-20500 Mondragón-Arrasate Spain Tel. ++34 943 71 92 00 Fax. ++34 943 79 17 12 www.fagorautomation.com
* Este mensaje y los documentos que, en su caso, lleve anexos, pueden contener información confidencial. Por ello, se informa a quien lo reciba por error que la información contenida en el mismo es reservada y su uso no autorizado está prohibido legalmente, por lo que en tal caso le rogamos que nos lo comunique por la misma vía , se abstenga de realizar copias del mensaje o remitirlo o entregarlo a otra persona y proceda a borrarlo de inmediato. * Mezu honek eta txertatuta eraman ditzakeen dokumentuek informazio konfidentziala izan dezakete. Hori dela eta, nahi gabe hartzen duenari jakinarazten zaio bertako informazioa erreserbatua dela eta baimenik gabe erabiltzea legez debekatuta dagoela; horregatik, bide beretik guri jakinarazteko eskatzen diogu, eta aldi berean mezuaren kopiarik ez egiteko, beste pertsona bati ez emateko eta berehala ezabatzeko erregutzen diogu." * This message together with any documents attached may contain confidential information. You are informed that if you should receive it by mistake, the information it contains is reserved and its use is not authorized. It is legally prohibited. If you have received this message by mistake, please let us know as soon as possible by e-mail. Do not make any copies of the message, nor send it or give it to anybody else. Please delete it right away.
MIKEL CARRASCO wrote:
However, later on we need our kernel to run as a real time task by means of RTAI, and we don't know if that is even possible with Wine/Winelib. Anybody knows if such a thing is possible?
Can you get you GUI compiled as a winelib app? if so, you can use the Linux IPC mechanisms from it, and the "kernel" can be 100% native Linux.
- This message together with any documents attached may contain
confidential information. You are informed that if you should receive it by mistake, the information it contains is reserved and its use is not authorized. It is legally prohibited. If you have received this message by mistake, please let us know as soon as possible by e-mail. Do not make any copies of the message, nor send it or give it to anybody else. Please delete it right away.
Well, confidential information is now archived on this list's web archives, as well as others. Tough.
On Thu, 06 May 2004 09:49:33 +0200, MIKEL CARRASCO wrote:
The main problem we are facing is communication between the GUI and the kernel. Under Windows we do so by means of shared memory (CreateFileMapping, ...) and we don't know very well how to do it in Linux. We have done some tests with Winelib and it seems like we are getting something.
Well, if you want the kernel to be pure Linux code then you could use #ifdef LINUX or whatever in the frontend to just use the POSIX shared memory APIs rather than the Win32 ones. That is probably the easiest route unless you wish to keep the code completely free of ifdefs.
However, later on we need our kernel to run as a real time task by means of RTAI, and we don't know if that is even possible with Wine/Winelib. Anybody knows if such a thing is possible?
What is RTAI? Realtiming a task in Linux is certainly possible but you need to be root to do it. I'm not sure that Wine implements this, you could have to do it using the right Linux calls. There was a thread on this last year, I think.
Another possible solution we've been thinking of is to tweak the Wineserver, so it does the file mapping the way we want (place in memory, format, etc.) and we can read/write it from our application's kernel using plain C functions.
I think this would be suboptimal: assuming your frontend code is reasonably modular why not just refactor things so you have a backend object that you can subclass with the right shared memory APIs for Linux and Win32?
thanks -mike
However, later on we need our kernel to run as a real time task by means of RTAI, and we don't know if that is even possible with Wine/Winelib. Anybody knows if such a thing is possible?
What is RTAI? Realtiming a task in Linux is certainly possible but you need to be root to do it. I'm not sure that Wine implements this, you could have to do it using the right Linux calls. There was a thread on this last year, I think.
No, this has nothing to do with Wine per se.
RTAI is a heavily-modified linux kernel, at least in the key areas of interaction with hardware and interrupt handling.
To get "hard real time" performance from any Linux system requires (1) a hard real version of Linux (RTLinux, RTAI etc) and (2) your task runs as a special kind of process known to the RT kernel. This is hard, but not impossible, to get going.
To get "soft real time" performance, you simply need a patched linux kernel (the morton low latency patches for 2.4; nothing as good exists for 2.6), and your task needs to run with SCHED_FIFO. there are lots of people who do this already, and its not hard.
Finally, you do not need to be root to do this if you have a kernel with capabilities enabled. This is (thankfully) becoming routine in the world of linux audio, where we routinely need this ability.
Wine is just a library. It doesn't have anything to do with running real time, except inasmuch as its code is often not RT-safe and so should never be called from code that is supposed to be running RT. The same can be said of any other library that you might use.
--p