From: Shan-leung Maverick WOO Date: 2002-01-05T04:37:52+09:00 Subject: [ruby-talk:30237] Re: cdecl vs stdcall On Sat, 5 Jan 2002, Yukihiro Matsumoto wrote: > Could you tell me what stdcall is, and what I should do to switch? I quote MS's documentation here: A __stdcall function's arguments are pushed onto the stack from right to left, and the called function pops these arguments from the stack before it returns. The catch with stdcall is that you cannot do varargs (at least not the straightforward way). For those, you can declare them as cdecl. For switching, I can only tell the MS story here. There is a compiler switch (/Gz) that says use stdcall by default and then there is some (typically small) changes to the source code like: process.c:594: RETSIGTYPE (__cdecl *hfunc)_((int)), (__cdecl *qfunc)_((int)), (__cdecl *ifunc)_((int)); I cannot estimate the work needed to get Ruby (1.6.6) to use stdcall correctly. To make it compile, I changed roughly 30 lines of source code but that won't be sufficient to make it run. It's actually much more effort because of the different stack management and GC issues. (And hence I resort to use a stub DLL for now and proposing this for consideration for future Ruby major release.) -- All the best, Maverick Woo