[cairo] Cario in Visual Basic

Tor Lillqvist tml at iki.fi
Mon Dec 18 02:39:17 PST 2006

Jelmer Baas writes:
 > Private Declare Function cairo_version Lib "libcairo-2.dll" () As String
 > Private Declare Function cairo_version_string Lib "libcairo-2.dll" () As String

 > Msgbox cairo_version
 > Msgbox cairo_version_string

 > No matter which one I call, VB6 crashes.

Doesn't VB by default (always?) call functions in DLLs using the
"stdcall" calling convention? The libcairo-2.dll DLL uses the "cdecl"
calling convention. You need to write glue code in C to put
inbetween. (Or, if possible, tell VB that the functions use cdecl.)

Also, why do you decalte cairo_version() as "String"? It returns an
int. cairo_version_string() returns a C "string", i.e. a char pointer,
but is there some mechanism that would automagically convert that into
a VB String, I have no idea.


More information about the cairo mailing list