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 347477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T11:16:27+00:00 2026-05-12T11:16:27+00:00

I am attempting to wrap some C code in Python using Pyrex. I’ve run

  • 0

I am attempting to wrap some C code in Python using Pyrex. I’ve run into an issue with defining two structs. In this case, the structures have been defined in terms of one another, and Pyrex cannot seem to handle the conflict. The structures look something like so:

typedef struct a {
    b * b_pointer;
} a;

typedef struct b {
    a a_obj;
} b;

They are placed in different files. The code I am using to wrap the structures looks like this:

def extern from "file.c": 
    ctypdef struct a: 
            b * b_pointer 
    ctypedef struct b: 
            a a_obj

File.c is a separate file containing function definitions, as opposed to the structure definitions, but it includes the source files that define these structures. Is there some way I can wrap both of these structures?

  • 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-12T11:16:28+00:00Added an answer on May 12, 2026 at 11:16 am

    You can use an incomplete type (you do need the corresponding C typedefs in to be in a .h file, not just a .c file):

    cdef extern from "some.h":
      ctypedef struct b
      ctypedef struct a:
        b * b_pointer
      ctypedef struct b:
        a a_obj
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm attempting to place some embed code into a Premium WordPress Theme. NOTE: I'm
Attempting to use XStream's JavaBeanConverter and running into an issue. Most likely I'm missng
I am attempting to call a C++ API from python. Following is the code
I am using SQLite3 for iPhone development and I'm attempting to wrap a few
I am converting some Java NIO code to run in Scala and I am
I am attempting to fix some bilingual xml files using regular expressions to match
I'm having some difficulty attempting to create an SSL socket in Python to use
I really can't wrap my head around this one. For some reason, (and I
very new to python so attempting to wrap my head around multi dimensional arrays.
I am attempting to wrap my head around one part of the Objective-C memory

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.