lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Jean-Claude Wippler wrote:
> Chris Tavares <ctavares@develop.com> wrote:
>
> >> Thank you very much, this is exactly what I was looking for!
> >> Too bad it is compiler dependent (although it supports two of the most
> >> populars), and have inline assembly code (so it isn't portable
> for Alpha
> >> or Epoc, plus I have less control on it)...
> >> But it resolves a problem far more complex than I though.
> >
> >Well, the problem is that you MUST use assembly to do this sort
> of thing -
> >higher level languages don't give you enough control over the stack and
> >registers to have any hope of setting up a call properly.
>
> Though this is a fine solution, I wouldn't go as far as that.  You can
> simply create a switch to calls with 0 to N arguments, with N some
> reasonable value.  Plus, for Windows a duplicate set for cdecl vs
> stdcall.  No brownie points for elegance, but it's pure C.

I also though of this, but the problem, as stated in the given article, is
that arguments have various sizes. Chars are mapped to 4 bytes, so are ints
of course, but floats and structures are bigger.
Now, I don't know much Windows API functions using floats, and structures
are usually passed by reference. Maybe I can give a try.

Note that the LTN3 is close to this problem too (and give precious
information). And it does use some assembly code...

Regards.

¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯
Philippe Lhoste (Paris -- France)
Professional programmer and amateur artist
http://jove.prohosting.com/~philho/
_.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._