[#22684] [Bug #1247] YAML::load converts some dates into strings — Matthew Wilson <redmine@...>

Bug #1247: YAML::load converts some dates into strings

10 messages 2009/03/05

[#22725] [Bug #1253] Fix MSVC Build Issues — Charlie Savage <redmine@...>

Bug #1253: Fix MSVC Build Issues

13 messages 2009/03/07

[#22727] Moving ruby 1.9.1 forward on windows — Charlie Savage <cfis@...>

Hi everyone,

14 messages 2009/03/08

[#22731] [Bug #1255] += for large strings egrigiously slow — James Lee <redmine@...>

Bug #1255: += for large strings egrigiously slow

11 messages 2009/03/08

[#22736] Ruby 1.9.1 and tail recursion optimization — =?ISO-8859-15?Q?Wolfgang_N=E1dasi-Donner?= <ed.odanow@...>

Moin, moin!

13 messages 2009/03/08
[#22739] Re: Ruby 1.9.1 and tail recursion optimization — =?ISO-8859-15?Q?Wolfgang_N=E1dasi-Donner?= <ed.odanow@...> 2009/03/08

Wolfgang N疆asi-Donner schrieb:

[#22748] [Feature #1256] Add constant TAILRECURSION to let a program recognize if tail recursion optimization is implemented — Wolfgang Nádasi-Donner <redmine@...>

Feature #1256: Add constant TAILRECURSION to let a program recognize if tail recursion optimization is implemented

7 messages 2009/03/08

[#22803] Relegate 1.8.6 to Engine Yard, part II — Urabe Shyouhei <shyouhei@...>

Hello and sorry for my being slow for this issue. It's OK now for me to pass

21 messages 2009/03/10

[#22812] [Bug #1261] cross-compiling Ruby extensions using mkmf doesn't fully respect DESTDIR — Daniel Golle <redmine@...>

Bug #1261: cross-compiling Ruby extensions using mkmf doesn't fully respect DESTDIR

8 messages 2009/03/10

[#22892] Ruby Time — valodzka <valodzka@...>

Got tired of current ruby Time limitation, I have written this -

24 messages 2009/03/14
[#22949] Re: Ruby Time — Tanaka Akira <akr@...> 2009/03/19

In article <9e19ed87-9d12-4f98-af3c-bd49a71b0bd4@p11g2000yqe.googlegroups.com>,

[#22974] Re: Ruby Time — valodzka <valodzka@...> 2009/03/20

[#22977] Re: Ruby Time — Urabe Shyouhei <shyouhei@...> 2009/03/20

valodzka wrote:

[#22981] Re: Ruby Time — valodzka <valodzka@...> 2009/03/21

> I bet you'll get tired of updating that database. There's a major difference

[#22893] [Feature #1291] O_CLOEXEC flag missing for Kernel::open — David Martin <redmine@...>

Feature #1291: O_CLOEXEC flag missing for Kernel::open

10 messages 2009/03/15

[#22939] [Bug #1303] A name considered a local variable on RHS of an assignment that defines it — Tomas Matousek <redmine@...>

Bug #1303: A name considered a local variable on RHS of an assignment that defines it

8 messages 2009/03/19

[#23063] [Bug #1332] Reading file on Windows is 500x slower then with previous Ruby version — Damjan Rems <redmine@...>

Bug #1332: Reading file on Windows is 500x slower then with previous Ruby version

11 messages 2009/03/30

[#23075] [Bug #1336] Change in string representation of Floats — Brian Ford <redmine@...>

Bug #1336: Change in string representation of Floats

37 messages 2009/03/31
[#23179] [Bug #1336] Change in string representation of Floats — Roger Pack <redmine@...> 2009/04/11

Issue #1336 has been updated by Roger Pack.

[#23181] Re: [Bug #1336] Change in string representation of Floats — Brent Roman <brent@...> 2009/04/11

[#23186] Re: [Bug #1336] Change in string representation of Floats — Yukihiro Matsumoto <matz@...> 2009/04/12

Hi,

[#23187] Re: [Bug #1336] Change in string representation of Floats — Brent Roman <brent@...> 2009/04/13

[#23188] Re: [Bug #1336] Change in string representation of Floats — Yukihiro Matsumoto <matz@...> 2009/04/13

Hi,

[ruby-core:23046] Back to ruby19.dll

From: Charlie Savage <cfis@...>
Date: 2009-03-28 22:03:21 UTC
List: ruby-core #23046
Hi everyone,

A couple of weeks ago 
(http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/22727) I 
proposed renaming the ruby shared library to ruby19.dll on windows.  Let 
me try again, maybe this time I'll be more convincing :)

Right now ruby includes the c runtime version in the ruby shared library 
name, so msvcrt-ruby19.dll or msvcr90-ruby19.dll.

I think this is a bad idea.  My conclusions are (read below if you want 
the details):

Conclusion #1 - Ruby can be use any c runtime.

Conclusion #2 - In some cases, a extension needs to use the same c 
runtime as the library it wraps.  This can happen with old, outdated 
libraries or unix-centric libraries.

Conclusion #3 - Libraries on windows are linked against a variety of c 
runtimes - pretending that msvcrt.dll is the one true library is fantasy.

Including the c runtime name in the ruby dll solves *no* issues.  But it 
does mean that gem maintainers have to provide multiple binary gems for 
windows depending on how Ruby is built.  And that is a bad idea that 
will impede adoption of ruby 1.9.1 on windows.

And now onto the gory details.


Extensions
=============
A typical ruby extension includes three parts - ruby, the extension and 
the library being wrapped.  Each can use a different version of the 
c-runtime.  As discussed many times before on this list, this leads to 
three potential issues - memory handling, errno handling and files handling.

So where do problems arise?  Let's take a look:

           ruby  <--->  extension  <----->  library
memory                               x
errno                                x
files             x                  x
 

This diagram shows that memory and errno handling is a non-issue between 
ruby and an extension.  This is because Ruby provides the ALLOC/xfree 
api for memory, and as far as I know, Ruby and extensions do not use 
errno to communicate (instead an extension should use rb_raise).

However, passing file handles on windows requires ruby, an extension and 
its library to all use the same c runtime.  Since that's unlikely (see 
below), it should be considered forbidden on windows.

Conclusion #1 - Ruby can use an c runtime version.  Adding the runtime 
library to ruby19.dll is pointless.


Problem Libraries
=================
In contrast, the diagram shows all three issues can arise between an 
extension and a library.  Let's look at two problem libraries:

gdbm - Does not provide an api to free memory that it allocates.  This 
is an old unix library that hasn't been updated since 2002 and I doubt 
is used much on Windows.

iconv - Uses errno to pass error information.  This is a popular library 
that is unix centric.  Looking at the Ruby extension, it could in fact 
get by without using errno, but that would be less satisfactory.

In both these cases, the extension has to use the same c runtime as the 
library itself (once again, it doesn't matter what c runtime ruby uses).

Conclusion #2 - In some cases, a extension needs to use the same c 
runtime as the library it wraps.  This can happen with old, outdated 
libraries or unix-centric libraries.


Modern Libraries
=============
Now let's look at some examples at common libraries and how their 
windows binaries are distributed:

postgreql - mscvr90 (VC 2008)
opensll   - mscvr90 (VC 2008)
freeimage - cleverly does not link against a c runtime (unknown)
libxml - msvcrt (windows xp ddk)
zlib - msvcrt

All of these libraries work fine, even when using a different c runtime 
than ruby or an extensions  In general, I've found that any modern 
library that is used on windows provides a memory management api, 
doesn't use errno and doesn't require passing file handles around.  If 
they did not, then they would not work well on windows (ruby of course 
isn't the only program to have c runtime issues).

Conclusion #3 - No matter what runtime Ruby links against, it will use 
libraries on windows that use a different runtime.

Summary
===========
I realize what I am proposing is controversial.  But if you look at how 
extensions are built, and real-world examples, hopefully it becomes 
clear that adding the c runtime version to the ruby shared library name 
does not solve any technical issues.

But it does put an undue burden on gem maintainers.  The days of 
msvcrt.dll and VC6 are over.  We must expect ruby 1.9.1 will be built 
with a variety of compilers - VC2008, VC2010, mingw and the Windows DDK. 
  Right now, gem maintainers would have to provide three different 
binary gems for windows (msvcrt-ruby19.dll, msvcr90-ruby19.dll, 
msvcr10-ruby19.dll).  That of course will never happen.

So what we should do:

* Rename the ruby shared libary to ruby19.dll
* Package gdbm and iconv with the windows one-click installer to make 
sure the extensions and library use the same c runtime (this already 
happens anyway)
* Clearly document to extension writers how to make their extensions 
windows compatible

Thanks,

Charlie

Attachments (1)

smime.p7s (3.16 KB, application/x-pkcs7-signature)

In This Thread

Prev Next