Why Integer?

This is the place for queries that don't fit in any of the other categories.

Why Integer?

Postby alabview » Tue Oct 29, 2013 2:50 pm

Hi there,

I have no idea why OUT = integer value as I declared it to c_double?

Basically, my DLL is very simple i.e. X + Y = Z

My code as below
Code: Select all
import ctypes
from sys import exit
X = ctypes.c_double(6.97)
Y = ctypes.c_double(5.18)
DLLHANDLE = ctypes.cdll.LoadLibrary("C:\\Walter\\Pyhton_Examples\\Math\\SharedLib.dll")
out = DLLHANDLE.SimpleMath(X,Y)

Output result as below,
Code: Select all
('Addition:', 0)
>>> type (out)
<type 'int'>

Noticed that, out = int and no idea why???and the out result should be in c_double ie 12.15 but display as 0

Many Thanks.
Posts: 22
Joined: Mon Sep 16, 2013 1:48 pm

Re: Why Integer?

Postby micseydel » Tue Oct 29, 2013 4:41 pm

We have no idea what's really happening in your DLL, so we can't say why. You'd have to give us that code, and tell us how you created the DLL.
Join the #python-forum IRC channel on irc.freenode.net for off-topic chat!

Please prefer not to PM members. The point of the forum is so that anyone can benefit. We don't want to help you over PMs/emails/Skype chats that others can't benefit from :)
User avatar
Posts: 2904
Joined: Tue Feb 12, 2013 2:18 am
Location: Mountain View, CA

Re: Why Integer?

Postby Kebap » Tue Oct 29, 2013 5:09 pm

All these threads, you seem to have a lot of trouble with python ctypes. With python int, it would be much easier. My suggestion, in python use int, etc. Only change to ctypes when you address the DLL directly.
New Users, Read These Hints

Learn: How To Ask Questions The Smart Way
Join the #python-forum IRC channel on irc.freenode.net and chat with uns directly!
Posts: 663
Joined: Thu Apr 04, 2013 1:17 pm
Location: Germany, Europe

Return to General Coding Help

Who is online

Users browsing this forum: Alexa [Bot] and 4 guests