import from python library

This is a discussion on import from python library within the C Programming forums, part of the General Programming Boards category; Does anyone know if I can import modules from a python library and use them in C. How can I ...

  1. #1
    Registered User
    Join Date
    Apr 2009
    Posts
    6

    import from python library

    Does anyone know if I can import modules from a python library and use them in C.
    How can I do this?

    Many thanks

  2. #2
    Making mistakes
    Join Date
    Dec 2008
    Posts
    476
    Of course.

    Code:
    Py_Initialize();
    PyObject *my_module = PyImport_Import("this");
    ...
    Py_Finalize();

  3. #3
    Registered User
    Join Date
    Apr 2009
    Posts
    6
    thanks Brafil

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. What's an import library?
    By chiefmonkey in forum C++ Programming
    Replies: 1
    Last Post: 06-19-2009, 05:00 PM
  2. dllimport
    By George2 in forum C++ Programming
    Replies: 15
    Last Post: 02-23-2008, 03:35 AM
  3. an easy, portable, python accessible graphics math library
    By ichijoji in forum Game Programming
    Replies: 2
    Last Post: 12-06-2006, 11:10 PM
  4. DLL generated but related import library is missing?
    By George2 in forum C Programming
    Replies: 0
    Last Post: 08-18-2006, 12:13 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21