Project

General

Profile

Bug #4214 » 0001-windows-macros-for-dl-n-fiddle.patch

jonforums (Jon Forums), 12/29/2010 06:39 AM

View differences:

ext/dl/cfunc.c
return Qnil;
}
#if defined(HAVE_WINDOWS_H)
#if defined(_WIN32)
#include <windows.h>
static ID id_win32_last_error;
......
}
rb_dl_set_last_error(self, INT2NUM(errno));
#if defined(HAVE_WINDOWS_H)
#if defined(_WIN32)
rb_dl_set_win32_last_error(self, INT2NUM(GetLastError()));
#endif
......
Init_dlcfunc(void)
{
id_last_error = rb_intern("__DL2_LAST_ERROR__");
#if defined(HAVE_WINDOWS_H)
#if defined(_WIN32)
id_win32_last_error = rb_intern("__DL2_WIN32_LAST_ERROR__");
#endif
rb_cDLCFunc = rb_define_class_under(rb_mDL, "CFunc", rb_cObject);
rb_define_alloc_func(rb_cDLCFunc, rb_dlcfunc_s_allocate);
rb_define_module_function(rb_cDLCFunc, "last_error", rb_dl_get_last_error, 0);
#if defined(HAVE_WINDOWS_H)
#if defined(_WIN32)
rb_define_module_function(rb_cDLCFunc, "win32_last_error", rb_dl_get_win32_last_error, 0);
#endif
rb_define_method(rb_cDLCFunc, "initialize", rb_dlcfunc_initialize, -1);
ext/dl/dl.h
#define RTLD_NOW 0
#endif
#else
# if defined(HAVE_WINDOWS_H)
# if defined(_WIN32)
# include <windows.h>
# define dlopen(name,flag) ((void*)LoadLibrary(name))
# define dlerror() strerror(rb_w32_map_errno(GetLastError()))
ext/dl/handle.c
VALUE rb_cDLHandle;
#ifdef HAVE_WINDOWS_H
#ifdef _WIN32
# ifndef _WIN32_WCE
static void *
w32_coredll(void)
......
rb_secure(2);
#if defined(HAVE_WINDOWS_H)
#if defined(_WIN32)
if( !clib ){
HANDLE rb_libruby_handle(void);
ptr = rb_libruby_handle();
ext/fiddle/extconf.rb
end
have_header 'sys/mman.h'
have_header 'windows.h'
create_makefile 'fiddle'
ext/fiddle/fiddle.c
rb_define_const(mFiddle, "TYPE_FLOAT", INT2NUM(TYPE_FLOAT));
rb_define_const(mFiddle, "TYPE_DOUBLE", INT2NUM(TYPE_DOUBLE));
#if defined(HAVE_WINDOWS_H)
#if defined(_WIN32)
rb_define_const(mFiddle, "WINDOWS", Qtrue);
#else
rb_define_const(mFiddle, "WINDOWS", Qfalse);
ext/fiddle/fiddle.h
#include <ruby.h>
#include <errno.h>
#if defined(HAVE_WINDOWS_H)
#if defined(_WIN32)
#include <windows.h>
#endif
ext/fiddle/function.c
ffi_call(cif, NUM2PTR(rb_Integer(cfunc)), &retval, values);
rb_funcall(mFiddle, rb_intern("last_error="), 1, INT2NUM(errno));
#if defined(HAVE_WINDOWS_H)
#if defined(_WIN32)
rb_funcall(mFiddle, rb_intern("win32_last_error="), 1, INT2NUM(errno));
#endif
(3-3/3)