Jan-05-2017, 12:35 PM
1. I've created a C file (timestamp.c) having a function which returns the Timestamp in string format.
2. For this C file I've created a DLL (timestamp.dll) file which can call the above Function through Python Script.
for example::
from ctypes import *
libc = cdll.LoadLibrary("C:\\MinGW\\bin\\timestamp.dll")
print libc.GetMicroSecTimeStamp()
3. After running this script I'm getting an output like this :: 1734103168
4. But I'm expecting an Output like this :: 1483617487.419234 (This is an output from executable C file using the same function)
5. I don't know whether the Python output is right or wrong. I guess it's a wrong one.
My question is whether the my DLL file is linking properly or not?
Below are the things I've done to generate & link the DLL file.
--> gcc -c timestamp.c -o timestamp.o
--> gcc -c timestamp.dll -s -shared timestamp.o
--> gcc -c main.c -o main.o
--> gcc -o main.exe -s main.o -L. -ltimestamp
then I copied the DLL file into "bin" directory of my C Compiler.
Are there any mistakes in my steps in Linking the DLL properly ?
My target is to Get the timestamps whenever I calls libc.GetMicroSecTimeStamp().
For that how can I Link my DLL file at run time ?
If any inputs needed please let me know.
Thanks in Advance.
2. For this C file I've created a DLL (timestamp.dll) file which can call the above Function through Python Script.
for example::
from ctypes import *
libc = cdll.LoadLibrary("C:\\MinGW\\bin\\timestamp.dll")
print libc.GetMicroSecTimeStamp()
3. After running this script I'm getting an output like this :: 1734103168
4. But I'm expecting an Output like this :: 1483617487.419234 (This is an output from executable C file using the same function)
5. I don't know whether the Python output is right or wrong. I guess it's a wrong one.
My question is whether the my DLL file is linking properly or not?
Below are the things I've done to generate & link the DLL file.
--> gcc -c timestamp.c -o timestamp.o
--> gcc -c timestamp.dll -s -shared timestamp.o
--> gcc -c main.c -o main.o
--> gcc -o main.exe -s main.o -L. -ltimestamp
then I copied the DLL file into "bin" directory of my C Compiler.
Are there any mistakes in my steps in Linking the DLL properly ?
My target is to Get the timestamps whenever I calls libc.GetMicroSecTimeStamp().
For that how can I Link my DLL file at run time ?
If any inputs needed please let me know.
Thanks in Advance.