Return type of the C function is always an integer while calling it using so file from python

26 Views Asked by At

I am trying to catch the return value of the function which written in .c file from .py file

Here is my C code snippet and it runs perfectly with main function for itself,

float checkRet(){


    float a = 0.34;
    return a;
}

and here my python code snippet

import ctypes
SoFunc = ctypes.cdll.LoadLibrary('/home/debian/test.so')    
while True:
    print SoFunc.checkRet();

and the output I am getting over my screen is

-1227793324

I want 0.340000 as my output. Can anyone help me regarding this?

0

There are 0 best solutions below