Jump to content

Python in C/C++?

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
4 replies to this topic

#1
JewFro297

JewFro297

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 224 posts
Is there any way to include python code in a C/C++ program? for example write a C++ program that prints hello world then calls a python script thats been linked to the executable then returns back to the C++ code after it's finished?
Yea Dat's right.
Apple sucks :thumbup:
[SIGPIC][/SIGPIC]

#2
CommittedC0der

CommittedC0der

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,565 posts
This may help, it's the documentation for extending Python through C++.
A man can be defined by what he does when no one is looking.
Science is only an educated theory, which we cannot disprove.

#3
JewFro297

JewFro297

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 224 posts
Thanks, looks good
Yea Dat's right.
Apple sucks :thumbup:
[SIGPIC][/SIGPIC]

#4
lthreed

lthreed

    Newbie

  • Members
  • PipPip
  • 18 posts
Yes you can run the python script file by calling it from the command line within the C++ program

#5
manux

manux

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 234 posts
You can also use distutils to compile C/C++ code and import it as a Python module(.pyd), and you can also call Python inside a C/C++ application and use the returned PyObjects* with the C Python API.

basically... the link thegamemaker gave you :D