ffi.dlopen('cairo') opens libcairo.so.2 on Linux and
ffi.dlopen('libcairo-2') opens libcairo-2.dll on Windows, but I haven’t found a name that works on both. I’ll add something like this to cairocffi:
def dlopen(names): for name in names: try: return ffi.dlopen(name) except OSError: pass ffi.dlopen(names) # Trigger the exception again cairo = dlopen(['cairo', 'libcairo-2']) # Maybe add variants for other platforms
It would be nice if
ffi.dlopen() could accept a list and do this itself.