I tried to call c function in python here is my code
string.c
#include <stdio.h>
int print(const char *str)
{
printf("%s", str):
return 0;
}
string.py
from ctypes import *
so_print = "/home/ubuntu/string.so"
my_functions = CDLL(so_print)
print(my_functions.print("hello"))
when i run the python script it prints only the fist character of the string
example "h"
How can i pass any string and my c code will read and display it.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…