C
Charles Mills
Hi,
I am trying to use rdoc to document a C extension. The file structure
of the extension is as follows:
ext.h
ext.c
ext_class1.c
ext_class2.c
ext_class3.c
...
where "EXT" is the module and "Class1", "Class2", etc are the classes
defined under "EXT".
So the name space looks like:
EXT
EXT::Class1
EXT::Class2
EXT::Class3
...
'ext.h' contains a global variable:
VALUE mEXT;
which is references the Ruby module EXT at runtime.
In 'ext_class1.c' (and friends) we have:
#include "ext.h"
/* ... */
void Init_EXT_Class1(void)
{
rb_define_class_under(mEXT, "Class1", rb_cObject);
/* define class methods ... */
}
In ext.c we have
#include "ext.h"
void Init_ext(void)
{
mEXT = rb_define_module("EXT");
Init_EXT_Class1();
Init_EXT_Class2();
Init_EXT_Class3();
/* ... */
}
So the problem is when documenting 'ext_class1.c' and friends rdoc
can't figure out what the variable 'mEXT' is (the module the classes
are defined under) and fails to document Class1 and friends.
Any solutions?
Putting everything in one .c file is not an option.
-Charlie
I am trying to use rdoc to document a C extension. The file structure
of the extension is as follows:
ext.h
ext.c
ext_class1.c
ext_class2.c
ext_class3.c
...
where "EXT" is the module and "Class1", "Class2", etc are the classes
defined under "EXT".
So the name space looks like:
EXT
EXT::Class1
EXT::Class2
EXT::Class3
...
'ext.h' contains a global variable:
VALUE mEXT;
which is references the Ruby module EXT at runtime.
In 'ext_class1.c' (and friends) we have:
#include "ext.h"
/* ... */
void Init_EXT_Class1(void)
{
rb_define_class_under(mEXT, "Class1", rb_cObject);
/* define class methods ... */
}
In ext.c we have
#include "ext.h"
void Init_ext(void)
{
mEXT = rb_define_module("EXT");
Init_EXT_Class1();
Init_EXT_Class2();
Init_EXT_Class3();
/* ... */
}
So the problem is when documenting 'ext_class1.c' and friends rdoc
can't figure out what the variable 'mEXT' is (the module the classes
are defined under) and fails to document Class1 and friends.
Any solutions?
Putting everything in one .c file is not an option.
-Charlie