diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-05-09 04:53:16 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-05-09 04:53:16 +0000 |
commit | 655e96fa59f62f7d31b2d9d470947f97aceb7b92 (patch) | |
tree | 6b6bb0a6ce9e46b326dbde9378c3791a54be1dd5 /ext | |
parent | 2a34f89e354071d09c64a93bf3498dfa108f3e8c (diff) |
2000-05-09
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@682 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r-- | ext/Win32API/Win32API.c | 22 | ||||
-rw-r--r-- | ext/extmk.rb.in | 16 | ||||
-rw-r--r-- | ext/socket/extconf.rb | 18 | ||||
-rw-r--r-- | ext/socket/socket.c | 2 |
4 files changed, 46 insertions, 12 deletions
diff --git a/ext/Win32API/Win32API.c b/ext/Win32API/Win32API.c index 433d13abeb..27693c7257 100644 --- a/ext/Win32API/Win32API.c +++ b/ext/Win32API/Win32API.c @@ -132,6 +132,7 @@ Win32API_Call(argc, argv, obj) VALUE import_type; int nimport, timport, texport, i; int items; + int ret; items = rb_scan_args(argc, argv, "0*", &args); @@ -162,7 +163,7 @@ Win32API_Call(argc, argv, obj) mov eax, lParam push eax } -#elif defined(__CYGWIN__) || defined(__MINGW32__) +#elif defined __GNUC__ asm volatile ("pushl %0" :: "g" (lParam)); #else #error @@ -184,7 +185,7 @@ Win32API_Call(argc, argv, obj) mov eax, pParam push eax } -#elif defined(__CYGWIN__) || defined(__MINGW32__) +#elif defined __GNUC__ asm volatile ("pushl %0" :: "g" (pParam)); #else #error @@ -194,6 +195,22 @@ Win32API_Call(argc, argv, obj) } } +#if defined __GNUC__ + asm volatile ("call *%1" : "=r" (ret) : "g" (ApiFunction)); + switch (texport) { + case _T_NUMBER: + case _T_INTEGER: + Return = INT2NUM(ret); + break; + case _T_POINTER: + Return = rb_str_new2((char *)ret); + break; + case _T_VOID: + default: + Return = INT2NUM(0); + break; + } +#else switch (texport) { case _T_NUMBER: ApiFunctionNumber = (ApiNumber *) ApiFunction; @@ -214,6 +231,7 @@ Win32API_Call(argc, argv, obj) Return = INT2NUM(0); break; } +#endif return Return; } diff --git a/ext/extmk.rb.in b/ext/extmk.rb.in index cbe0e6e5fa..7caa5985c2 100644 --- a/ext/extmk.rb.in +++ b/ext/extmk.rb.in @@ -329,6 +329,11 @@ def create_makefile(target) $DLDFLAGS = '@DLDFLAGS@' + if $configure_args['--enable-shared'] + $libs = "@LIBRUBYARG@ " + $libs + $DLDFLAGS = $DLDFLAGS + " -L" + $topdir + end + if RUBY_PLATFORM =~ /beos/ and not $static $libs = $libs + " @LIBRUBYARG@" $DLDFLAGS = $DLDFLAGS + " -L" + $topdir @@ -339,8 +344,6 @@ def create_makefile(target) if File.exist? target + ".def" defflag = "--def=" + target + ".def" end - $libs = $libs + " @LIBRUBYARG@" - $DLDFLAGS = $DLDFLAGS + " -L" + $topdir end $srcdir = $top_srcdir + "/ext/" + $mdir @@ -499,16 +502,11 @@ def extmake(target) $OBJEXT = "@OBJEXT@" $LIBEXT = "a" $objs = nil + $libs = "@DLDLIBS@" $local_flags = "" - case RUBY_PLATFORM - when /cygwin|beos|openstep|nextstep|rhapsody|macos|i386-os2_emx/ - $libs = "" - when /mswin32/ + if /mswin32/ =~ RUBY_PLATFORM $LIBEXT = "lib" - $libs = "" $local_flags = "$(topdir)/rubymw.lib -link /EXPORT:Init_$(TARGET)" - else - $libs = "-lc" end $LOCAL_LIBS = "" # to be assigned in extconf.rb dir = with_config("opt-dir") diff --git a/ext/socket/extconf.rb b/ext/socket/extconf.rb index 1adb7cc1b5..91ac8f6123 100644 --- a/ext/socket/extconf.rb +++ b/ext/socket/extconf.rb @@ -173,7 +173,7 @@ have_header("netinet/tcp.h") have_header("netinet/udp.h") $getaddr_info_ok = false -if try_run(<<EOF) +if not enable_config("wide-getaddrinfo", false) and try_run(<<EOF) #include <sys/types.h> #include <netdb.h> #include <string.h> @@ -292,6 +292,22 @@ else have_header("resolv.h") end +if !try_link(<<EOF) +#include <sys/types.h> +#include <netdb.h> +#include <string.h> +#include <sys/socket.h> +#include <netinet/in.h> +int +main() +{ + socklen_t len; + return 0; +} +EOF + $CFLAGS="-Dsocklen_t=int "+$CFLAGS +end + have_header("sys/un.h") if have_func(test_func) diff --git a/ext/socket/socket.c b/ext/socket/socket.c index 2ad653cc4a..bbd5057741 100644 --- a/ext/socket/socket.c +++ b/ext/socket/socket.c @@ -6,6 +6,8 @@ $Date$ created at: Thu Mar 31 12:21:29 JST 1994 + Copyright (C) 1993-2000 Yukihiro Matsumoto + ************************************************/ #include "ruby.h" |