[#6363] Re: rescue clause affecting IO loop behavior — ts <decoux@...>

>>>>> "D" == David Alan Black <dblack@candle.superlink.net> writes:

17 messages 2000/11/14
[#6367] Re: rescue clause affecting IO loop behavior — David Alan Black <dblack@...> 2000/11/14

Hello again --

[#6582] best way to interleaf arrays? — David Alan Black <dblack@...>

Hello --

15 messages 2000/11/26

[#6646] RE: Array Intersect (&) question — Aleksi Niemel<aleksi.niemela@...>

Ross asked something about widely known and largely ignored language (on

23 messages 2000/11/29
[#6652] RE: Array Intersect (&) question — rpmohn@... (Ross Mohn) 2000/11/29

aleksi.niemela@cinnober.com (Aleksi Niemel) wrote in

[#6723] Re: Array Intersect (&) question — Mathieu Bouchard <matju@...> 2000/12/01

> >Use a hash. Here's code to do both and more. It assumes that

[#6656] printing/accessing arrays and hashes — raja@... (Raja S.)

I'm coming to Ruby with a Python & Common Lisp background.

24 messages 2000/11/30

[ruby-talk:6165] mkmf: Why not have_library(lib, [funcs])?

From: Robert Feldt <feldt@...>
Date: 2000-11-08 11:13:15 UTC
List: ruby-talk #6165
Hi,

Really minor question/proposal:

Why can you only test that one func is available with
have_library? Wouldn't it be nice to give an array of funcs (the ones you
need in your extension)?

You can do multiple calls to have_library but that will include the lib
multiple times => doesn't look nice.

Below is the simple patch. I'd appreciate if you have an opinion/comment.

Regards,

Robert


*** mkmf.rb.orig	Wed Nov  8 11:50:00 2000
--- mkmf.rb	Wed Nov  8 12:10:15 2000
***************
*** 148,160 ****
  
  def append_library(libs, lib)
    if /mswin32/ =~ RUBY_PLATFORM
!     lib + ".lib " + libs
    else
!     "-l" + lib + " " + libs
    end
  end
  
  def have_library(lib, func="main")
    printf "checking for %s() in -l%s... ", func, lib
    STDOUT.flush
  
--- 148,173 ----
  
  def append_library(libs, lib)
    if /mswin32/ =~ RUBY_PLATFORM
!     str_to_append = lib + ".lib "
    else
!     str_to_append = "-l" + lib + " "
!   end
!   if libs.include?(str_to_append)
!     libs
!   else
!     str_to_append + libs
    end
  end
  
  def have_library(lib, func="main")
+   if Array == func.type
+     func.each {|function| library_have_function(lib, function)}
+   else
+     library_have_function(lib, func)
+   end
+ end
+ 
+ def library_have_function(lib, func="main")
    printf "checking for %s() in -l%s... ", func, lib
    STDOUT.flush
  
***************
*** 195,200 ****
--- 208,221 ----
  end
  
  def find_library(lib, func, *paths)
+   if Array == func.type
+     func.each {|function| library_find_function(lib, function, paths)}
+   else
+     library_have_function(lib, func)
+   end
+ end
+ 
+ def library_find_function(lib, func, *paths)
    printf "checking for %s() in -l%s... ", func, lib
    STDOUT.flush


In This Thread

Prev Next