# Issues

Issue #125 wontfix

Erik Norvelle
created an issue

I was able to compile and install CFFI for Windows 7 using Visual Studio 2010 Express, using a 64-bit compilation environment. I am now trying to run a program (Weasyprint) that uses CFFI to load the Cairo dll (libcairo-2.dll), which I downloaded in a 64-bit version from the GTK+ web site.

I am now getting the following errors:

\$ weasyprint
Traceback (most recent call last):
File "c:\anaconda\envs\py33\lib\site-packages\cffi-0.8-py3.3-win-amd64.egg\cffi\api.py", line 399, in _make_ffi_library
OSError: cannot load library libcairo-2.dll: error 0x7e

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Anaconda\envs\py33\Scripts\weasyprint-script.py", line 9, in <module>
File "C:\Anaconda\envs\py33\lib\site-packages\pkg_resources.py", line 343, in load_entry_point
File "C:\Anaconda\envs\py33\lib\site-packages\pkg_resources.py", line 2355, in load_entry_point
File "C:\Anaconda\envs\py33\lib\site-packages\pkg_resources.py", line 2061, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "c:\anaconda\envs\py33\lib\site-packages\weasyprint-0.20-py3.3.egg\weasyprint\__init__.py", line 309, in <module>
from .css import PARSER, preprocess_stylesheet
File "c:\anaconda\envs\py33\lib\site-packages\weasyprint-0.20-py3.3.egg\weasyprint\css\__init__.py", line 30, in <module>
from . import computed_values
File "c:\anaconda\envs\py33\lib\site-packages\weasyprint-0.20-py3.3.egg\weasyprint\css\computed_values.py", line 18, in <module>
from .. import text
File "c:\anaconda\envs\py33\lib\site-packages\weasyprint-0.20-py3.3.egg\weasyprint\text.py", line 18, in <module>
import cairocffi as cairo
File "c:\anaconda\envs\py33\lib\site-packages\cairocffi-0.5.1-py3.3.egg\cairocffi\__init__.py", line 39, in <module>
cairo = dlopen(ffi, 'libcairo-2.dll', 'cairo', 'libcairo-2')
File "c:\anaconda\envs\py33\lib\site-packages\cairocffi-0.5.1-py3.3.egg\cairocffi\__init__.py", line 34, in dlopen
return ffi.dlopen(names[0])  # pragma: no cover
File "c:\anaconda\envs\py33\lib\site-packages\cffi-0.8-py3.3-win-amd64.egg\cffi\api.py", line 117, in dlopen
lib, function_cache = _make_ffi_library(self, name, flags)
File "c:\anaconda\envs\py33\lib\site-packages\cffi-0.8-py3.3-win-amd64.egg\cffi\api.py", line 405, in _make_ffi_library
OSError: cannot load library C:\Windows\system32\libcairo-2.dll: error 0x7e


I am unable to figure out what is happening here, since I am a Python programmer, and my Windows programming skills are pretty meager. Any help would be appreciated.

My Windows programming skills are even more meager than yours. You may have more chances asking on the python-cffi mailing list, or on general forums like StackOverflow. Do you get the same error with ctypes?

1. reporter

Thanks Armin, I'll try on those forums. It's often hard to know where to go to post questions.

I have no idea what ctypes are... I hate low-level programming, which is why I abandoned C for Java (and later Python) as soon as I could.

Fwiw, Googling for "error 0x7e" shows a lot of corrupted files issues. Maybe try to reinstall libcairo-2.dll from scratch. If it doesn't help, double-check that you're not mixing 32-bit and 64-bit dll's and executables.

2. reporter

I have asked this question on several other lists, including the Cairo project site itself. The issue almost certainly has to do with how the DLL is compiled... it seems to require compilation under Visual Studio 2008, in 64 bit mode. Unfortunately, I have not been able to make the instructions given at the Cairo site to work. My understanding of Windows OS internals is meager at best, and I have no desire to learn more. I wished to use CFFI in order to run Weasyprint under Windows, but I have run out of patience with Windows programming, and nobody with knowledge of these issues has responded to my various posts. I do Python programming precisely in order to avoid this sort of thing.

All the best, Erik

3. Thanks, marking this as Won't Fix as long as it doesn't show up again.