droidvideo
2009-Jul-26 15:40 UTC
[Wine] Help! How to mix win32 and native os calls in code?
Hi I have a tool that I am running under Mac version of Wine. What I am doing is installing the tool under wine (i.e wine <path to installer pkg.exe>) and then running it from wine. It uses an api to capture current screen (BitBlt api). Under Mac, it is capturing the X windows frame buffer instead of native Quartz frame buffer. I have source code for this tool. I am thinking of replacing Windows api for screen capture with Mac's native apis. I am wondering if someone can point me in right direction. a) How do I find in code if I am running under regular win32 or wine? If wine, how do I find host OS (i.e Is it Linux or OS X?) b) Lets say I know some how what OS the exe is running. I want to call say LeopardCaptureScreen() on Mac. One way is to include corresponding .h and link implicitly. But it won't compile under windows. Any pointers on how to separate this logic in such a way that the mac code can be compiled on Mac and be loaded under wine. c) Any pointers on how to capture current screen on Mac OS X. I know it should be posted under Mac forum, thought of asking here as lot of smart people are reading this forum. Thanks for your help Joe
vitamin
2009-Jul-26 17:17 UTC
[Wine] Re: Help! How to mix win32 and native os calls in code?
droidvideo wrote:> a) How do I find in code if I am running under regular win32 or wine? > If wine, how do I find host OS (i.e Is it Linux or OS X?)Simple answer - DO NOT DO IT. droidvideo wrote:> b) Lets say I know some how what OS the exe is running. I want to call say LeopardCaptureScreen() on Mac.Then why don't you create a native Mac application that does just that? You can do this _only_ in winelib application (line Wine's winecfg). It will _not_ work on Windows. Also when you doing any native calls, you have to take care of proper synchronization, or you'll end-up crashing, locking up your program. droidvideo wrote:> c) Any pointers on how to capture current screen on Mac OS X?Wrong forum, people here know mostly *NIS & win32 api. Not Mac.
Austin English
2009-Jul-26 17:35 UTC
[Wine] Help! How to mix win32 and native os calls in code?
On Sun, Jul 26, 2009 at 12:17 PM, vitamin<wineforum-user at winehq.org> wrote:> > droidvideo wrote: >> a) How do I find in code if I am running under regular win32 or wine? >> If wine, how do I find host OS (i.e Is it Linux or OS X?)This question has been asked several times. Search the archives for answers.> droidvideo wrote: >> c) Any pointers on how to capture current screen on Mac OS X? > > Wrong forum, people here know mostly *NIS & win32 api. Not Mac.Mac _IS_ Unix. -- -Austin
Gert van den Berg
2009-Jul-26 19:39 UTC
[Wine] Help! How to mix win32 and native os calls in code?
On Sun, Jul 26, 2009 at 19:35, Austin English<austinenglish at gmail.com> wrote:>> droidvideo wrote: >>> c) Any pointers on how to capture current screen on Mac OS X? >> >> Wrong forum, people here know mostly *NIS & win32 api. Not Mac. > > Mac _IS_ Unix.Yes, but the default GUI is not X11... (And a lot of the APIs are a lot more OpenStep-like AFAIK, with Unix APIs available for some things)
James McKenzie
2009-Jul-26 23:26 UTC
[Wine] Help! How to mix win32 and native os calls in code?
Gert van den Berg wrote:> On Sun, Jul 26, 2009 at 19:35, Austin English<austinenglish at gmail.com> wrote: > >>> droidvideo wrote: >>> >>>> c) Any pointers on how to capture current screen on Mac OS X? >>>> >>> Wrong forum, people here know mostly *NIS & win32 api. Not Mac. >>> >> Mac _IS_ Unix. >> > > Yes, but the default GUI is not X11... > > (And a lot of the APIs are a lot more OpenStep-like AFAIK, with Unix > APIs available for some things) >Gert, Austin and the rest: X11 is now installed by default with Leopard. Apple recognizes that not all applications are going to be Aqua compliant and some will never be. This is a distinct disadvantage. BTW, it took many man-years to get OpenOffice.org and Aqua to work well with each other. Sadly, I do not think we have the manpower to do this for Wine. Wine will remain an X11 application and for that reason, many Mac users will not use it. James McKenzie
Eric S. Johansson
2009-Jul-27 01:04 UTC
[Wine] Help! How to mix win32 and native os calls in code?
James McKenzie wrote:> Gert van den Berg wrote: >> On Sun, Jul 26, 2009 at 19:35, Austin English<austinenglish at gmail.com> wrote: >> >>>> droidvideo wrote: >>>> >>>>> c) Any pointers on how to capture current screen on Mac OS X? >>>>> >>>> Wrong forum, people here know mostly *NIS & win32 api. Not Mac. >>>> >>> Mac _IS_ Unix. >>> >> Yes, but the default GUI is not X11... >> >> (And a lot of the APIs are a lot more OpenStep-like AFAIK, with Unix >> APIs available for some things) >> > Gert, Austin and the rest: > > X11 is now installed by default with Leopard. Apple recognizes that not > all applications are going to be Aqua compliant and some will never > be. This is a distinct disadvantage. BTW, it took many man-years to > get OpenOffice.org and Aqua to work well with each other. Sadly, I do > not think we have the manpower to do this for Wine. Wine will remain an > X11 application and for that reason, many Mac users will not use it. > > James McKenzieAllow me to sort of hijack this thread. I need to convert program that bridges naturally speaking to Python. It set up to use a lot of Windows 32 calls making naturally speaking do the right thing. Is it possible to make this code (natlink) talk to naturally speaking and wine as a Windows 32 but speak to Python in Linux so we can do all our fun command-and-control stuff.
droidvideo
2009-Jul-27 03:51 UTC
[Wine] Re: Help! How to mix win32 and native os calls in code?
Hi If Wine doesn't have an api to detect Wine vs native Win32, I can check for $WINEPREFIX and use that to detect Wine. Not a big deal. I appreciate if you can point me to a better method. What is not clear is how you can call into native .so from win32 code. I saw some interesting posts on this forum before when someone tried to include this functionality into Wine (Search for winegate.dll). I don't want to compile my whole code against winelib as my app is MFC based. Compiling MFC against winelib seems a daunting task. I don't have time and resources to pursue that route. The tool that I am trying to run needs access to native Quartz frame buffer not the X11 frame buffer which is what wine provides. I need to call Leopard api from Win32 app. Some one pointed that it can be accomplished using wine_dlopen/wine_dlsym type calls. I couldn't find any examples. I will look more. I appreciate your help. Thanks Joe
vitamin
2009-Jul-27 05:43 UTC
[Wine] Re: Help! How to mix win32 and native os calls in code?
Eric S. Johansson wrote:> Allow me to sort of hijack this thread.You may not.
Eric S. Johansson
2009-Jul-27 15:26 UTC
[Wine] Help! How to mix win32 and native os calls in code?
vitamin wrote:> Eric S. Johansson wrote: >> Allow me to sort of hijack this thread. > > You may not. >ok, rethreaded even though it is the same class of problems see: How to mix (naturally speaking) win32 and native (python) linux calls in same application?
droidvideo
2009-Jul-27 17:17 UTC
[Wine] Re: Help! How to mix win32 and native os calls in code?
How do you create separate winelib dll? I am assuming the dll can call into native api, but I am wondering how the main win 32 app calls into this dll. Can you point me to faq or link that talks about this? Thanks Joe
vitamin
2009-Jul-28 05:00 UTC
[Wine] Re: Help! How to mix win32 and native os calls in code?
droidvideo wrote:> How do you create separate winelib dll?Take a look at any ... Wine's own dll. droidvideo wrote:> I am assuming the dll can call into native api, but I am wondering how the main win 32 app calls into this dll.Yes, from winelib you can call any native (OS/X, POXIX, etc) function you want. Just keep in mind how much it affects everything else (locking, synchronization, memory allocations, etc). And you call that dll from your app the same way as you would do it on real Windows - LoadLibrary, GetProcAddress, and so on. droidvideo wrote:> I'll be interested in hearing what you think is a good alternative architecture. > I am basing my work off of the original Windows code. It connects to the COM interface for NaturallySpeaking and creates an extension in Python so that grammars can activate methods with or without arguments.If it's uses COM you can't do much with that outside of Wine. You can however add a library/interface into Wine, then use it to talk to the outside of Wine using any RPC of your liking. One way or the other you will need to write something native, as Wine can't (and won't in the near future) "inject" anything into other X windows. It's made that way for a reason, so windows programs can only be told what to do.