Error on windows: ImportError: DLL load failed: The specified procedure could not be found.

242 views
Skip to first unread message

Marko Loparic

unread,
Nov 29, 2011, 1:21:13 PM11/29/11
to cython...@googlegroups.com
Hello,

My code works well on linux but not on windows. Is there someone here
who could tell me what the problem is? Or what I could do to try to
find it?

I have isolated the problem. It is related to the usage of the C
function mktime. My cython code uses a big C library, but I have
created a very small set of files reproducing the issue.

1. A C code file c_functions.c (containing the C function calling to
mktime) and its header c_functions.h:

http://pastebin.com/3dhZWdsG
http://pastebin.com/nX7YBh6a

2. A cython code calling the C function:

http://pastebin.com/HVeeEWHf

3. a setup.py:

http://pastebin.com/W0399XZ5

Then, launching the setup and doing

python -c 'import test; test.test()'

I get

Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: DLL load failed: The specified procedure could not be found.

Here are the commands that I type on a cygwin session:

http://pastebin.com/ZT387V71

This zip file contains all the files.

https://docs.google.com/open?id=0B7FeQUZkr7BNMzgyNjEzOWEtZjRiMi00ZDEzLTk2N2QtOTIxYjA0Y2QwZmJk

Note 1: I am using cython, python and gcc from the default windows
packages, not from cygwin. Applying the same commands in a DOS session
the problem persists.
Note 2: Doing the same on a linux (ubuntu) machine, the import is successful.
Note 3: Calling c_functions.c from a C code (see c_test.c) everything
works fine. No special compilation or link option is needed.
Note 4: The import works if I comment out the line with the mktime
call in the C code.

Thanks a lot for any suggestion,
Marko

Marko Loparic

unread,
Dec 4, 2011, 11:03:14 AM12/4/11
to cython...@googlegroups.com
Restating my question: Can someone propose me a way to debug this
import error on windows? I would like to understand why the
compilation of the C code generated by cython generates a broken dll
while the compilation of a pure C code doesn't.

Thanks,
Marko

Lisandro Dalcin

unread,
Dec 12, 2011, 11:00:25 PM12/12/11
to cython...@googlegroups.com
On 4 December 2011 13:03, Marko Loparic <marko....@gmail.com> wrote:
> Restating my question: Can someone propose me a way to debug this
> import error on windows? I would like to understand why the
> compilation of the C code generated by cython generates a broken dll
> while the compilation of a pure C code doesn't.
>

http://www.dependencywalker.com/

--
Lisandro Dalcin
---------------
CIMEC (INTEC/CONICET-UNL)
Predio CONICET-Santa Fe
Colectora RN 168 Km 472, Paraje El Pozo
3000 Santa Fe, Argentina
Tel: +54-342-4511594 (ext 1011)
Tel/Fax: +54-342-4511169

Reply all
Reply to author
Forward
0 new messages