Bug #1230 ยป stdcall.patch
ext/dl/cfunc.c (working copy) | ||
---|---|---|
switch( cfunc->type ){
|
||
case DLTYPE_VOID:
|
||
#define CASE(n) case n: { \
|
||
DECL_FUNC_STDCALL(f,void,DLSTACK_PROTO##n) = cfunc->ptr; \
|
||
DECL_FUNC_STDCALL(f,void,DLSTACK_PROTO##n##_) = cfunc->ptr; \
|
||
f(DLSTACK_ARGS##n(stack)); \
|
||
result = Qnil; \
|
||
}
|
||
... | ... | |
break;
|
||
case DLTYPE_VOIDP:
|
||
#define CASE(n) case n: { \
|
||
DECL_FUNC_STDCALL(f,void*,DLSTACK_PROTO##n) = cfunc->ptr; \
|
||
DECL_FUNC_STDCALL(f,void*,DLSTACK_PROTO##n##_) = cfunc->ptr; \
|
||
void * ret; \
|
||
ret = f(DLSTACK_ARGS##n(stack)); \
|
||
result = PTR2NUM(ret); \
|
||
... | ... | |
break;
|
||
case DLTYPE_CHAR:
|
||
#define CASE(n) case n: { \
|
||
DECL_FUNC_STDCALL(f,char,DLSTACK_PROTO##n) = cfunc->ptr; \
|
||
DECL_FUNC_STDCALL(f,char,DLSTACK_PROTO##n##_) = cfunc->ptr; \
|
||
char ret; \
|
||
ret = f(DLSTACK_ARGS##n(stack)); \
|
||
result = CHR2FIX(ret); \
|
||
... | ... | |
break;
|
||
case DLTYPE_SHORT:
|
||
#define CASE(n) case n: { \
|
||
DECL_FUNC_STDCALL(f,short,DLSTACK_PROTO##n) = cfunc->ptr; \
|
||
DECL_FUNC_STDCALL(f,short,DLSTACK_PROTO##n##_) = cfunc->ptr; \
|
||
short ret; \
|
||
ret = f(DLSTACK_ARGS##n(stack)); \
|
||
result = INT2NUM((int)ret); \
|
||
... | ... | |
break;
|
||
case DLTYPE_INT:
|
||
#define CASE(n) case n: { \
|
||
DECL_FUNC_STDCALL(f,int,DLSTACK_PROTO##n) = cfunc->ptr; \
|
||
DECL_FUNC_STDCALL(f,int,DLSTACK_PROTO##n##_) = cfunc->ptr; \
|
||
int ret; \
|
||
ret = f(DLSTACK_ARGS##n(stack)); \
|
||
result = INT2NUM(ret); \
|
||
... | ... | |
break;
|
||
case DLTYPE_LONG:
|
||
#define CASE(n) case n: { \
|
||
DECL_FUNC_STDCALL(f,long,DLSTACK_PROTO##n) = cfunc->ptr; \
|
||
DECL_FUNC_STDCALL(f,long,DLSTACK_PROTO##n##_) = cfunc->ptr; \
|
||
long ret; \
|
||
ret = f(DLSTACK_ARGS##n(stack)); \
|
||
result = LONG2NUM(ret); \
|
ext/dl/dl.h (working copy) | ||
---|---|---|
stack[10],stack[11],stack[12],stack[13],stack[14],\
|
||
stack[15],stack[16],stack[17],stack[18],stack[19]
|
||
#define DLSTACK_PROTO0
|
||
#define DLSTACK_PROTO0_
|
||
#define DLSTACK_PROTO1_ DLSTACK_TYPE
|
||
#define DLSTACK_PROTO2_ DLSTACK_PROTO1_, DLSTACK_TYPE
|
||
#define DLSTACK_PROTO3_ DLSTACK_PROTO2_, DLSTACK_TYPE
|
ext/dl/win32/lib/Win32API.rb (working copy) | ||
---|---|---|
def initialize(dllname, func, import, export = "0")
|
||
@proto = [import].join.tr("VPpNnLlIi", "0SSI").sub(/^(.)0*$/, '\1')
|
||
handle = DLL[dllname] ||= DL.dlopen(dllname)
|
||
@func = DL::CFunc.new(handle[func], TYPEMAP[export.tr("VPpNnLlIi", "0SSI")], func)
|
||
@func = DL::CFunc.new(handle[func], TYPEMAP[export.tr("VPpNnLlIi", "0SSI")], func, :stdcall)
|
||
rescue DL::DLError => e
|
||
raise LoadError, e.message, e.backtrace
|
||
end
|