I made a Ruby extension library in C


The person who wrote this article is a beginner with a level of ** programming experience of less than 1 year **. I think there are some confusing parts and mistakes, so if you notice it, please leave a comment.

What I made

Extension library for operating the mouse from Ruby

Language used

--C (describe the library itself) --Ruby (module)


The source code is here

--You can get the coordinates of the mouse cursor and move the cursor. --It is also possible to output left click and right click. --Since it includes C windows.h, it is ** Windows only **. (It has not been verified because I do not have an environment other than Windows, but it is probably so) --Since it is compiled in a 32-bit environment, it does not work on a 64-bit machine . (Verified) ――When the environment is ready, I will raise the 64-bit version. - Please use in an environment where Ruby works **.

How to use

require 'mouse' Or (If the scripts that use this library are in the same directory) require_relative 'mouse'

Defined methods and constants

Recommended Posts

I made a Ruby extension library in C
Ruby: I made a FizzBuzz program!
I wrote a C parser (like) using PEG in Ruby
I tried a calendar problem in Ruby
I made a risky die with Ruby
I made a rock-paper-scissors game in Java (CLI)
Create a native extension of Ruby in Rust
I made a portfolio with Ruby On Rails
I made a simple calculation problem game in Java
[CentOS, Eclipse] Load a library file in a C project
[Ruby] I made a crawler with anemone and nokogiri.
I made a Restful server and client in Spring.
I made a library that works like a Safari tab !!
I made a library for displaying tutorials on Android.
I made roulette in Java.
I made a chat app.
Ruby C extension and volatile
I made an interpreter (compiler?) With about 80 lines in Ruby.
[Beginner] I made a program to sell cakes in Java
I searched for a web framework with Gem in Ruby
I want to create a Parquet file even in Ruby
Sorting hashes in a Ruby array
I created a PDF in Java.
I made a GUI with Swing
Implement a gRPC client in Ruby
I made a simple recommendation function.
I made an annotation in Java.
Make a SOAP call in C #
I made a matching app (Android app)
I made a package.xml generation tool.
[Android] I made a pedometer app.
I made a Ruby container image and moved the Lambda function
I tried to write code like a type declaration in Ruby
[Ruby] I want to put an array in a variable. I want to convert to an array
I made a reply function for the Rails Tutorial extension (Part 1)
[Ruby 3.0] A memo that I added a type definition to a library I wrote
A memorial service for the library used when competing in Ruby
I made a reply function for the Rails Tutorial extension (Part 5):
I tried to make a parent class of a value object in Ruby
I was in trouble at work, so I made a plugin for IntelliJ
I made various Fibonacci sequence functions (Ruby)
When installing a gem with C extension in Ruby, I want to finish it quickly using multiple CPU cores like make -j4
Methods that I found useful in Ruby
I made a plugin for IntelliJ IDEA
I made a rock-paper-scissors app with kotlin
I made a calculator app on Android
I thought about the best way to create a ValueObject in Ruby
I tried the AutoValue library in Intellij
I made a new Java deployment tool
How to publish a library in jCenter
I made a rock-paper-scissors app with android
I made a bulletin board using Docker 1
I made a reply function for Rails Tutorial extension (Part 2): Change model
I tried embedding a formula in Javadoc
I made a simple graph library for smartphone apps [MP Android Chart Kai]
I made a sample of how to write delegate in SwiftUI 2.0 using MapKit
I made a Diff tool for Java files
Escape processing when creating a URL in Ruby
AtCoder Beginner Contest 169 A, B, C with ruby
04. I made a front end with SpringBoot + Thymeleaf
I made a mosaic art with Pokemon images