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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:37:36+00:00 2026-05-27T19:37:36+00:00

I have a standalone Python module used to perform analysis on some raw data.

  • 0

I have a standalone Python module used to perform analysis on some raw data. The module is working great.

Now I need the output generated by the Python module in C source that will do further processing on output.

Here is the rough idea of flow:

  1. C source will call the Python module.
  2. Python module will fill the results generated into a C structure and
    then somehow pass it to C source.

So what is the best way to get the results from Python module in C source code?

Should I use something like the following to fill the results?

from ctypes import *
class result(Structure):       
    _fields_ = [("status", c_int), ...]
  • 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-27T19:37:37+00:00Added an answer on May 27, 2026 at 7:37 pm

    I don’t think you’ll want to use the ctypes module — that module is for accessing DLLs and shared objects from Python code, not the other way around.

    You don’t specify how the C program is going to invoke the Python module. Will it

    • invoke the Python script using something like popen from C? If so, then you can write data to stdout in Python and interpret the data appropriately in C. You’ll have to design your own little protocol for this. This can be an ad-hoc protocol, or you can use existing formats like JSON, for which you’ll find libraries for both C and Python.

    • embed the Python VM in your C program? Then you’ll need to convert the C values into appropriate Py* values and put them into a PyTuple that you can pass as an argument to the Python function, from C. The output of the Python function will be a PyObject, which you’ll have to unpack (in C) to get the data.

    In both cases, you’ll need to do the packing and unpacking yourself.

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

Sidebar

Related Questions

I have a standalone Java app that has some licensing code that I want
I need to write a standalone Java application which will have a embedded HTTP
Are there any standalone type conversion libraries? I have a data storage system that
I am trying to use 'py2app' to generate a standalone application from some Python
I've used Sphinx to document a Python library. So far this works great, I
I'm writing a Python module for some C++ code using SIP. However whilst I
I have a standalone Java application that gets data from a database and displays
I have a standalone aspx with vb.net backend file. I need to import google
Does MSTest have standalone GUI similar to nUnit that lets me use it and
I have a standalone enum type defined, something like this: package my.pkg.types; public enum

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.