[#1207] warning in ruby extension eats memory — Eugene Scripnik <Eugene.Scripnik@...>

This message was posted to ruby-talk, but I didn't get responce from

22 messages 2003/07/01
[#1208] Re: warning in ruby extension eats memory — ts <decoux@...> 2003/07/01

>>>>> "E" == Eugene Scripnik <Eugene.Scripnik@itgrp.net> writes:

[#1209] Re: warning in ruby extension eats memory — Eugene Scripnik <Eugene.Scripnik@...> 2003/07/02

ts wrote:

[#1210] Re: warning in ruby extension eats memory — ts <decoux@...> 2003/07/02

>>>>> "E" == Eugene Scripnik <Eugene.Scripnik@itgrp.net> writes:

[#1211] Re: warning in ruby extension eats memory — Eugene Scripnik <Eugene.Scripnik@...> 2003/07/04

ts wrote:

[#1212] Re: warning in ruby extension eats memory — ts <decoux@...> 2003/07/04

>>>>> "E" == Eugene Scripnik <Eugene.Scripnik@itgrp.net> writes:

[#1213] Re: warning in ruby extension eats memory — Eugene Scripnik <Eugene.Scripnik@...> 2003/07/04

ts wrote:

[#1214] Re: warning in ruby extension eats memory — ts <decoux@...> 2003/07/04

>>>>> "E" == Eugene Scripnik <Eugene.Scripnik@itgrp.net> writes:

[#1215] Re: warning in ruby extension eats memory — Eugene Scripnik <Eugene.Scripnik@...> 2003/07/04

ts wrote:

[#1237] FTP.new with block — Gavin Sinclair <gsinclair@...>

Hi,

22 messages 2003/07/19
[#1238] Re: [Patch] FTP.new with block — ts <decoux@...> 2003/07/19

>>>>> "G" == Gavin Sinclair <gsinclair@soyabean.com.au> writes:

[#1240] Re: [Patch] FTP.new with block — Mathieu Bouchard <matju@...> 2003/07/19

[#1297] Fix for Bug 1058 — Markus Walser <walser@...>

Hi,

16 messages 2003/07/25

[RFC] Add have_defined() and rework have_struct_member()

From: Michal Rokos <m.rokos@...>
Date: 2003-07-21 08:12:59 UTC
List: ruby-core #1257
Hello,

I'm trying to bring OpenSSL < 0.9.6 to OSSL2 module and while doing this
I needed to test whether some constats and functions are defined in
some.h.

I didn't find the way to do this in current mkmf.rb, so I defined
function have_defined() to solve this.

The second thing I was facing was testing whether some struct has
member. The current function have_struct_member() defined
-DHAVE_ST_MEMBER, but for 2 struct and same member you cannot
distinguish which one is defined and which isn't. So I changed it to
-DHAVE_ST_STRUCT_MEMBER.

Please concider whether is it OK to merge this.

    Michal

-- 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Michal Rokos                         Czech Technical University, Prague
e-mail: m.rokos@sh.cvut.cz    icq: 36118339     jabber: majkl@jabber.cz
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Attachments (1)

MKMF.diff (1010 Bytes, text/x-diff)
Index: lib/mkmf.rb
===================================================================
RCS file: /src/ruby/lib/mkmf.rb,v
retrieving revision 1.137
diff -u -p -r1.137 mkmf.rb
--- lib/mkmf.rb	18 Jul 2003 09:44:28 -0000	1.137
+++ lib/mkmf.rb	21 Jul 2003 06:25:34 -0000
@@ -434,7 +434,26 @@ def have_struct_member(type, member, hea
 int main() { return 0; }
 int s = (char *)&((#{type}*)0)->#{member} - (char *)0;
 SRC
-      $defs.push(format("-DHAVE_ST_%s", member.upcase))
+      $defs.push(format("-DHAVE_ST_%s", member.upcase)) # compatibility - deprecated
+      $defs.push(format("-DHAVE_ST_%s_%s", type.upcase, member.upcase))
+      true
+    else
+      false
+    end
+  end
+end
+
+def have_defined(macro, header=nil)
+  checking_for "#{macro}" do
+    if try_compile(<<"SRC")
+#{COMMON_HEADERS}
+#{cpp_include(header)}
+#if !defined(#{macro})
+#  error #{macro} not defined
+#endif
+int main() { return 0; }
+SRC
+      $defs.push(format("-DHAVE_%s", macro.upcase))
       true
     else
       false

In This Thread

Prev Next