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.
Due to the reasons discussed here we will be moving to python-forum.io on October 1, 2016.

This forum will be locked down and no one will be able to post/edit/create threads, etc. here from thereafter. Please create an account at the new site to continue discussion.
User avatar
Posts: 3000
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: 689
Joined: Thu Apr 04, 2013 1:17 pm
Location: Germany, Europe

Return to General Coding Help

Who is online

Users browsing this forum: Bing [Bot] and 8 guests