forked from jruby/jruby
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Additional rbconfig tweaks for extconf; the included sample ext build…
…s and loads correctly with jruby-loadmod. git-svn-id: http://svn.codehaus.org/jruby/trunk/jruby@6841 961051c9-f516-0410-bf72-c9f7e237a7b7
- Loading branch information
Showing
3 changed files
with
54 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Loads mkmf which is used to make makefiles for Ruby extensions | ||
require 'mkmf' | ||
|
||
# Give it a name | ||
extension_name = 'mytest' | ||
|
||
# The destination | ||
dir_config(extension_name) | ||
|
||
# Do the work | ||
create_makefile(extension_name) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Include the Ruby headers and goodies | ||
#include "ruby.h" | ||
|
||
// Defining a space for information and references about the module to be stored internally | ||
VALUE MyTest = Qnil; | ||
|
||
// Prototype for the initialization method - Ruby calls this, not you | ||
void Init_mytest(); | ||
|
||
// Prototype for our method 'test1' - methods are prefixed by 'method_' here | ||
VALUE method_test1(VALUE self); | ||
|
||
// The initialization method for this module | ||
void Init_mytest() { | ||
MyTest = rb_define_module("MyTest"); | ||
rb_define_method(MyTest, "test1", method_test1, 0); | ||
} | ||
|
||
// Our 'test1' method.. it simply returns a value of '10' for now. | ||
VALUE method_test1(VALUE self) { | ||
int x = 10; | ||
return INT2NUM(x); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters