From: ts [mailto:decoux@moulon.inra.fr ]
Sent: Thursday, August 08, 2002 8:08 AM
To: ruby-talk@ruby-lang.org
Cc: ruby-talk@ruby-lang.org
Subject: Re: struct needs to be a constant?
rb_struct_define(“Proto::ProtoStruct”,“name”,“aliases”,“number”,0);
^^^^^^^^^^^^^^^^^^^^
^^
^^
This is this that 1.7 don’t like, and I understand it.
I’m not sure what mean here (I’m having difficulty translating). Are you
saying that this is expected behavior and that you agree with it?
void Init_proto()
^^^^^
^^^^^
Now nobody can write an extension with the name `proto’, even if your
extension is called via ‘require “net/proto”’
Not true, at least not if I understand you correctly. With my own version
of Net::Proto already installed, I wrote this and installed it:
#include “ruby.h”
#include <stdio.h>
void Init_proto()
{
VALUE t_mTest, cTest;
t_mTest = rb_define_module(“Test”);
cTest = rb_define_class_under(t_mTest,“Proto”,rb_cObject);
printf(“Yes, this extension works, even though it’s called ‘Proto’\n”);
}
In the extconf.rb I did this:
require "mkmf"
create_makefile(‘test/proto’)
Then I did:
require "net/proto"
require “test/proto”
It seemed to work fine. Have I missed something?
Regards,
Dan
···
-----Original Message-----
ts1
(ts)
8 August 2002 14:15
2
This is this that 1.7 don't like, and I understand it.
I'm not sure what mean here (I'm having difficulty translating). Are you
saying that this is expected behavior and that you agree with it?
Yes expected behavior and yes I agree with it : you have strange
characters "::" in the name of the constant
Not true, at least not if I understand you correctly. With my own version
of Net::Proto already installed, I wrote this and installed it:
Well, personnaly I'll not trust this because you have defined *twice* the
function Init_proto()
Guy Decoux
ts1
(ts)
9 August 2002 08:02
4
They are in different modules, and names from extension
libraries are not exported to others by default, unless one was
linked with another.
And if someone want to have a static version of ruby with these libraries,
how he do this ?
Guy Decoux
ts1
(ts)
9 August 2002 09:28
6
I see. The issue would need discussion. How do you consider?
No good idea, actually. but try to compile a static version of ruby with
tk and you'll see that actually it exist a problem.
Guy Decoux
Hi,
I see. The issue would need discussion. How do you consider?
No good idea, actually.
What about searching Init_“feature”() function first? If it
failed, search Init_“basename”() function as now.
but try to compile a static version of ruby with
tk and you’ll see that actually it exist a problem.
Hmmm, I’m not sure but do you mean the difference between the
directory name “tk” and the module name “tkutil”?
···
At Fri, 9 Aug 2002 18:28:26 +0900, ts wrote:
–
Nobu Nakada
ts1
(ts)
10 August 2002 11:43
8
Hmmm, I'm not sure but do you mean the difference between the
directory name "tk" and the module name "tkutil"?
Yes, this is this case
static version of ruby
pigeon% ldd ruby
not a dynamic executable
pigeon%
ruby has registered "tk"
pigeon% ./ruby -e 'p $"'
["curses", "dbm", "digest", "dl", "etc", "fcntl", "gdbm", "iconv", "nkf",
"pty", "readline", "sdbm", "socket", "stringio", "strscan", "syslog",
"tcltklib", "tk", "digest/md5", "digest/rmd160", "digest/sha1",
"digest/sha2", "racc/cparse"]
pigeon%
but it try to load 'tkutil.so '
pigeon% ./ruby -rtk -e 1
/home/ts/local/r17/lib/ruby/1.7/tk.rb:8:in `require': No such file to load -- tkutil (LoadError)
from /home/ts/local/r17/lib/ruby/1.7/tk.rb:8
pigeon%
it has generated
Init_tkutil();
rb_provide("tk");
I have not yet understood this case, where, apparently, the user request
for an extension but ruby try to load another extension
Guy Decoux