
Security News
Meet the Socket Team at RSAC and BSidesSF 2025
Join Socket for exclusive networking events, rooftop gatherings, and one-on-one meetings during BSidesSF and RSA 2025 in San Francisco.
Sitar is easy to use the fiddle.
Add this line to your application's Gemfile:
gem 'sitar'
And then execute:
$ bundle
Or install it yourself as:
$ gem install sitar
You can used C method only to extend sitar and load shared library like follow:
C function in libsample.so
int add(int a, int b) {
return a + b;
}
Use in ruby.
module M
extend Sitar
load 'libsample.so'
end
M.add(1, 2).ret_i # => 3
Method | Return Type in C | Return Type in Ruby | Description |
---|---|---|---|
call | void | nil | Not returned value. |
ret_i | int | Integer | Returned int value. |
ret_s | char * | String | Return string pointer. |
ret_ws | wchar_t * | String | Return wide char string pointer. |
ret_f | float | Float | Return float value. |
ret_d | double | Float | Return double value. |
You can easy to use struct by Sitar::Types::StructFactory
.
e.g.
module M
extend Sitar
extend Sitar::Types::StructFactory
# struct Car {
# int id;
# char name[20];
# };
define 'Car', ["int id", "char name[20]"]
# struct Owner {
# int seq;
# struct Car cars[3];
# };
define 'Owner', ["int seq", "Car cars[3]"]
define_eval(self)
end
M::CAR.malloc
owner = M::OWNER.malloc
# Car cars[3] is expanded like follow:
# struct Owner {
# int seq;
# int id_1;
# char name_1[20];
# int id_2;
# char name_2[20];
# int id_3;
# char name_3[20];
# }
owner.id_1
owner.name_1
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that sitar demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Join Socket for exclusive networking events, rooftop gatherings, and one-on-one meetings during BSidesSF and RSA 2025 in San Francisco.
Security News
Biome's v2.0 beta introduces custom plugins, domain-specific linting, and type-aware rules while laying groundwork for HTML support and embedded language features in 2025.
Security News
Next.js has patched a critical vulnerability (CVE-2025-29927) that allowed attackers to bypass middleware-based authorization checks in self-hosted apps.