Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7165501
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:15:36+00:00 2026-05-28T14:15:36+00:00

I have some C source code and want to wrap it in Cython. Now,

  • 0

I have some C source code and want to wrap it in Cython. Now, the problem is, that there is a structure called print, and externing it throws a syntax error.

cdef extern from "foo.h":
    struct print:
        # ...

Same problem would appear when an attribute or a function or alike is called like a keyword.

cdef extern from "foo.h":
    struct foo:
        bint print
    print(char*, int)

Is there a way to work around this, without modifieng the source? Maybe some technique that replaces a proxy-name with the real-name in the source-file ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T14:15:37+00:00Added an answer on May 28, 2026 at 2:15 pm

    I think the solution you are looking for is something along the lines of:

    cdef extern from "foo.h":
        struct print "MY_print":
            double var "MY_var"
    

    print.var will then be defined by:

    MY_print.MY_var
    

    This way you can rename structs, functions, unions and enums from the header file. The names are converted when Cython compiles your code into C code.

    The relevant part of Cython documentation can be found here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So far I have managed to write some code that should print the source
I have a c++ source code that was written in linux/unix environment by some
I have some source code file which has mixed tabs/spaces and I want to
I have some VB source code and want to convert it to Delphi: Do
I have some source code that was compiled on Windows. I am converting it
I have some C# source code that I got off the Internet and I
I have some source code to get the file name of an url for
I have some C++ source code with templates maybe like this - doxygen runs
I have some HTML errors in my output source code, coming from one of
I have been looking through some code on an open source project recently and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.