zizzo81
2009-Jan-16 18:21 UTC
[Wine] How to discover within my application if executed in Wine?
Hi, I'm a Delphi (Windows) developer and I was trying to use Wine to execute my applications on Linux (actually using a Kubuntu 8.10) Most thing works great, but some don't. I was wondering if there's a way to discover if I'm under Windows or Linux just having a function like IsWine() that returns a boolean value. In this way I will be able to fix those small things that don't work and have my application running on both systems. I tryed checking for OS version, like I do on Windows but I get an empty response from Wine. I could take this as an answer (in such case the return value should be TRUE), but that isn't a professional way of getting information from the system. Does anyone know a call to system function that will return if I'm under Windows or Linux? Thank you. Christian
Austin English
2009-Jan-16 18:36 UTC
[Wine] How to discover within my application if executed in Wine?
On Fri, Jan 16, 2009 at 12:21 PM, zizzo81 <wineforum-user at winehq.org> wrote:> Hi, > I'm a Delphi (Windows) developer and I was trying to use Wine to execute my applications on Linux (actually using a Kubuntu 8.10)Cool!> Most thing works great, but some don't.http://bugs.winehq.org> I was wondering if there's a way to discover if I'm under Windows or Linux just having a function like IsWine() that returns a boolean value. In this way I will be able to fix those small things that don't work and have my application running on both systems.We discourage this. The best thing to do would be fix those bugs in wine. Short of that, fix your application in a way that works on both, not hacks for wine/windows depending on the implementation. Depending on hacks for wine is bad practice, as if it's updated in the future, or fixed, your app may break unexpectedly/weirdly. You know the code for your app, so fixing wine is already easier. If you can't fix the bug, file good bug reports (with test cases).> I tryed checking for OS version, like I do on Windows but I get an empty response from Wine. I could take this as an answer (in such case the return value should be TRUE), but that isn't a professional way of getting information from the system. > > Does anyone know a call to system function that will return if I'm under Windows or Linux?If you're still convinced you want to do this (again, discouraged). A few ways to do it: Check for wine specific registry entries. Check environmental variables (I used this method for automated testing with AutoHotKey, I doubt any windows machine has the 'SHELL' environmental variable, unless running under cygwin, which wouldn't work anyway ;-).) Test for broken behavior, which may be viable if any windows version is affected. Again, ways to do it (best to worst): 1) Fix properly in wine. 2) Adjust app in way that works in windows AND wine, sans hacks. 3) Detect wine, hack around it (BAD). -- -Austin
IneedAname
2009-Jan-17 17:31 UTC
[Wine] How to discover within my application if executed in Wine?
On Fri, 16 Jan 2009 12:21:53 -0600 "zizzo81" <wineforum-user at winehq.org> wrote:> I'm a Delphi (Windows) developer and I was trying to use Wine to execute my applications on Linux (actually using a Kubuntu 8.10)You may want to give Lazarus a try. http://www.lazarus.freepascal.org/
Apparently Analagous Threads
- Re: How to discover within my application if executed in Wine?
- a simple Asterisk AMI interface with Delphi (or Lazarus+FreePascal)
- What to do to use libvorbis with FreePascal?
- is it possible to run delphi apps(forms) using wine
- Native libpq.so instead of libpq.dll?