F
F
FireFly20452014-07-24 17:59:34
Python
FireFly2045, 2014-07-24 17:59:34

How should you call C functions in Python?

Problem:
You need to make a call to a C function in Python. While made through creation of dll in VS. But it turned out that the dll created in this way cannot be used, for example, under Linux. And I want the program to work under any operating system.
Can you please tell me how to call a C function in python. Maybe you can do everything without dll?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
T
tsarevfs, 2014-07-24
@tsarevfs

Under linux, everything is about the same . For different systems, the C code must be recompiled, and this is indispensable.

F
FireFly2045, 2014-07-24
@FireFly2045

Is there any alternative that doesn't exist? After all, it would seem that both there and there are ordinary c code + ordinary python.

H
HallEffect, 2014-07-25
@HallEffect

Under Linux, instead of .dll, you need to build the code in .so, and to call functions, you can use ctypes, which works fine with dynamic libraries for both win and tench

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question