Skip to content
Advertisement

On a Mac can Mono be used to build with winsock2.h?

Want to practice with some Microsoft specific tools; specifically winsock2.h. I know Mono can be used to make C# programs, but before doing the install I hope to find out if it does more than that.

Advertisement

Answer

For APIs like winsock2.h, you’re talking about the direct win32 API and related libraries.

Mono/C# provides higher-level networking APIs via the language run-time which removes the need to use these low-level, platform specific APIs.

As a result, you can’t use C# via Mono on a Mac to work with the winsock2.h APIS. The underlying library and code simply won’t be there on that platform. You will really need to use a windows system to work with them, and in this case, it would be easier to use C/C++ when working with them.

Some potential approaches to working on the win32 APIs on a mac are:

  • Virtualization using a VM – e.g. virtualbox, vmware, parallels
  • Dual boot using bootcamp (You may be able to VM boot your bootcamp partition while still running OSX, but this is pretty much the same as virtualization, you just save on disk space)

You could try using wine for emulation of the windows APIs, but I’ve not even considered it as the effort would probably exceed the benefit, and you’re still going to end up writing C/C++ code.

Advertisement