Skip to content
Navigation Menu
Sign in
Products
Platform
GitHub
Repository hosting, code review, and collaboration
Copilot
AI coding agent for tasks, projects and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Events
Changelog
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Team
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
GitHub Universe
The event for developers, by developers — talks, workshops, and what’s next for GitHub.
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
iij
mruby
Repository navigation
Code
Issues
1
(1)
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
More
items
Tips
Jump to bottom
tsahara-iij edited this page
Oct 29, 2012
·
2 revisions
mrb_str_new2() と mrb_str_new_cstr() の違い
引数はどちらも同じ (mrb_state *mrb, const char *p) でやることもほぼ同じ
ただし mrb_str_new2() は p == NULL の時に ArgumentError 例外を上げる。 mrb_str_new_cstr() は何も考えずに NULL にアクセスする(たぶん SIGSEGV 発生)。
Ruby 文字列(String) から C 文字列の作り方
mrb_str_to_cstr(mrb, str) を呼ぶ。
返り値の char *ptr は C 言語的な NUL 終端文字列になっている。
引数の str が NUL を含む String だった場合、mrb_str_to_cstr は例外を上げる。
ptr はヒープに確保されている。GC で回収されるため GC が走る前に必要に応じて退避すること。
Wiki pages
Pages
24
Loading
Home
Uh oh!
There was an error while loading.
Please reload this page
.
Loading
ask matz a question(2013 1 28)
Uh oh!
There was an error while loading.
Please reload this page
.
Loading
Debugger
Uh oh!
There was an error while loading.
Please reload this page
.
Loading
Difference from CRuby
Uh oh!
There was an error while loading.
Please reload this page
.
Loading
Dir
Uh oh!
There was an error while loading.
Please reload this page
.
Loading
Errno
Uh oh!
There was an error while loading.
Please reload this page
.
Loading
Extensions to be merged
Uh oh!
There was an error while loading.
Please reload this page
.
Loading
How to write a new mrbgem
Uh oh!
There was an error while loading.
Please reload this page
.
Loading
Internal API
Uh oh!
There was an error while loading.
Please reload this page
.
Loading
IO
Uh oh!
There was an error while loading.
Please reload this page
.
Loading
IO_memo
Uh oh!
There was an error while loading.
Please reload this page
.
Loading
ipaddr
Uh oh!
There was an error while loading.
Please reload this page
.
Loading
Pitfalls
Uh oh!
There was an error while loading.
Please reload this page
.
Loading
Regexp
Uh oh!
There was an error while loading.
Please reload this page
.
Loading
Regexp engines
Uh oh!
There was an error while loading.
Please reload this page
.
Loading
Regexp specification
Uh oh!
There was an error while loading.
Please reload this page
.
Loading
RegexpTesting
Uh oh!
There was an error while loading.
Please reload this page
.
Loading
Repair iij branch
Uh oh!
There was an error while loading.
Please reload this page
.
Loading
require
Uh oh!
There was an error while loading.
Please reload this page
.
Loading
S1
Uh oh!
There was an error while loading.
Please reload this page
.
Loading
Socket
Uh oh!
There was an error while loading.
Please reload this page
.
Loading
Socket on IO
Uh oh!
There was an error while loading.
Please reload this page
.
Loading
Special Variables
Uh oh!
There was an error while loading.
Please reload this page
.
Loading
Tips
mrb_str_new2() と mrb_str_new_cstr() の違い
Ruby 文字列(String) から C 文字列の作り方
Show 9 more pages…
Clone this wiki locally
You can’t perform that action at this time.