Desarrollador Rucha
Desarrollador Rucha

Reputation: 45

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

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?

Upvotes: 0

Views: 20

Answers (0)

Related Questions