Skip to content

old-style callback in Windows worked with cffi 1.16, crashes with cffi 1.17.1.  #139

Description

@jmp75

Context

A colleague reported an issue that I first reproduced as a 0xC0000005: Access violation executing location on some windows platforms. After a bit of diagnosing I noticed a change of implementation of dlopen for Windows in cffi=1.17, and the crash does not occur with cffi=1.16.

Also relates to this google group post

Repro

A repro is available from jmp75/py-cffi-callback-repro @ f7e1267. The program completes with cffi==1.16, but crashes with cffi==1.17.1 when activating the callback:

before registration
after registration
before has_callback_registered
after has_callback_registered
before triggering callback
...crash...

Observations

The change in the underlying implementation of dlopen for Windows may have been motivated by cffi/issues/64 , leading to the change Win32: pass the flags from dlopen() to LoadLibraryEx() #65.

dlopen under the hood in windows used to call return (void *)LoadLibraryA(filename); and it has now changed to return (void *)LoadLibraryExA(filename, NULL, flags);

I note I always passed flag(s) = 1, and note it seems to have been previously ignored on Windows.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions