Native OSX calls using .NET Core and pinvoke

As an experiment I wanted to write some code in .NET Core that would call native OSX call to perform an action not exposed by .NET Core. I decided to make a program that would simply move the mouse a little bit.

This ended up being really simple once I figured out a few gotchas. 


  • check
    The DllImports need to reference the CoreGraphics framework, not a dylib file.
  • check
    OSX wants 64 bit types!

I tried using PointF at first and it eventually dawned on me that it was using 32bit Singles and I needed Doubles. After marshaling it kept putting my cursor at 0,0 🙂 

I think it would be pretty fun to write a Mouse Without Borders clone using .NET Core 2.1 and maybe SignalR? 


I'm a software developer and consultant living in Cary, North Carolina. I work for a small consulting firm based out of Clemmons, North Carolina. We have clients all over the state. I've had amazing opportunities to work with different technologies and business problems since getting started in 2009. My goals for this site are simply to share interesting things I run into or do.