[fetter-devel] More on overloaded C++ functions -> Lisp ???

Rayiner Hashem rayiner at gmail.com
Tue Sep 27 19:31:29 UTC 2005


The functions are emitted in the same order as they are declared in
the header file.* So the first function is for regular chars, and the
second for wide chars. I suppose I could mangle the name to encode
this type information, but it'd have to be pretty straight forward to
not get completely ugly. How about the name of each type that differs
between all overloads of a function name? In this particular case,
you'd end up with FTFont-Render-pchar and FTFont-Render-pwchar-t. In
more complex cases, you'd get very long function names, so maybe there
should be some sort of limit? It's really a trade-off between
usability and predictability (the former of which is a function of the
latter...)

Sincerely,
    Rayiner Hashem

* This isn't quite so fragile as one would expect, since C++ virtual
function tables are also defined by the ordering in the header file.
Thus, C++ libraries generally don't change the declaration order,
because that'd break binary compatibility with client code.

Sincerely,
    Rayiner Hashem

On 9/27/05, Kenny Tilton <ktilton at nyc.rr.com> wrote:
>
>
> > Next issue. I get these two bindings for FTGL:
> >
> > (cffi:defcfun ("_ZN6FTFont7AdvanceEPKw" FTFont-Advance) :float
> >  (this :pointer) (string :pointer))
> > (cffi:defcfun ("_ZN6FTFont7AdvanceEPKc" FTFont-Advance-1) :float
> >  (this :pointer) (string :pointer))
> >
> > The first corresponds to an overloaded  C++ method specialized (if you
> > will) on a string of wchar_ts, the second to a string of chars. I
> > guess that is the trailing w/c in the mangled name. Having done this
> > research (by examining the FTGL C++ source), I guess I will go with
> > Advance-1, but there seems to be a problem here. Just not sure where.
>
> OK, here is a second case of the above, a little hairier:
>
> (cl:defun FTFont-Render (this string)
>   (vzn:virtual-funcall this 6 0 :pointer this :pointer string :void))
>  (cl:defun FTFont-Render-1 (this string)
>   (vzn:virtual-funcall this 7 0 :pointer this :pointer string :void))
>
> This is still the char vs wchar thing, but now I cannot tell which is
> which.
>
> --
> Kenny
>
> Why Lisp? http://wiki.alu.org/RtL_Highlight_Film
>
> "I've wrestled with reality for 35 years, Doctor, and I'm happy to state I finally won out over it."
>     Elwood P. Dowd, "Harvey", 1950
>
>
>
> _______________________________________________
> fetter-devel mailing list
> fetter-devel at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/fetter-devel
>



More information about the fetter-devel mailing list