Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • cffi cffi
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 74
    • Issues 74
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 5
    • Merge requests 5
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • PyPyPyPy
  • cfficffi
  • Issues
  • #198
Closed
Open
Issue created May 27, 2015 by Bitbucket Importer@bitbucket_importerMaintainer

Corrupted constant of opaque type "struct{...;}"

Created originally on Bitbucket by dalcinl (Lisandro Dalcin)

Sorry, not patches this time, I cannot figure out where is the problem.

#!python
from cffi import FFI
ffi = FFI()
ffi.set_source('example1',"""
typedef int opaque_t;
#define CONSTANT ((opaque_t)42)
static int toint(opaque_t o) { return o; }
""")
ffi.cdef("""
typedef struct{...;} opaque_t;
const opaque_t CONSTANT;
int toint(opaque_t);
""")
ffi.compile()

from example1 import ffi,lib
print(lib.toint(lib.CONSTANT)) # should print 42
print(lib.toint(lib.CONSTANT)) # should print 42
#!shell
$ python -c "import cffi; print(cffi.__version__)"
1.0.3
$ python example1_run.py 
42
1482790048
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking