Python Forum
Integration of Python and C using .dll files
Thread Rating:
  • 2 Vote(s) - 2.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Integration of Python and C using .dll files
#1
To whom it may concern,

I am a student working on a senior design project to create a new software system to collect and display data from a particular data acquisition unit.  The company that created the unit has provided a universal library that works with c,c#,vb, and .net (I think).  I am presently trying to use python to accomplish this task.  Right now I am just trying to connect to the data acquisition unit using their universal language in order to receive temperature data.  I have imported their .dll file and can call the function using ctypes.  However, the function is set up to return an error message and pass temperature data as a float through an in-out variable.  So, my question is this, how do I get the value from an argument in a function that I called?  In general, it looks kind of like this:

error_code = dll.Function_name( integer, integer, integer, float *variable I need*, integer)

I've been using ctypes to create ctypes.c_int and ctypes.c_float to try to create the necessary arguments, but I cannot seem to get them to actually turn into a value.  When I print the value, it prints ctypes.c_int(0) or whatever integer I try to make.

So, I guess that's two questions.

1) How do I get the value that should be passed in and then passed back out of the function?
2) Why are the ctypes integers and floats not actually making integers and float variables?

Thank you in advance,

Zach
Reply


Messages In This Thread
Integration of Python and C using .dll files - by zbiegler - Mar-14-2017, 04:24 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to run this triple integration in python Safinazsalem 1 358 May-20-2024, 11:43 AM
Last Post: Axel_Erfurt

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020