views:

223

answers:

2

Is it possible to use native Win API functions in Mono through Wine? Are there some additional libraries for interactions between Mono and Wine?

+1  A: 

Just some helpful tidbits I've found so far:

Looks like Mono does support P/Invoke (half way down you'll see a section on Marshalling).

So, I think it could potentially work, if Wine correctly supports the Win API call you're trying to make. You'll never really be able to call the native Win API function, but if there's a Wine interpretation, theoretically it should work. Just make sure to run your Mono project inside of Wine.

Any reason you're not virtualizing and running Mono on Windows itself?

Jon Smock
I know that mono supports native P/Invoke. But I want to use some console winapi calls in Linux environment.
macropas
I think it should just be a matter of looking up your calls and seeing if there's a Wine implementation yet. Do you have a list of specific calls by any chance?
Jon Smock
+1  A: 

This will only work if you install and use the Windows version of Mono inside the Wine environment. No additional libraries should be needed. However, P/Invoke that affects the Windows Forms GUI likely won't work, because Mono's Windows Forms doesn't actually wrap native controls, but instead is implemented using fully managed code.

There's probably a better way to do what you want, if you could be more specific.

mhutch