This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author owenl
Recipients owenl
Date 2010-09-17.09:11:55
SpamBayes Score 2.55522e-08
Marked as misclassified No
Message-id <1284714742.48.0.856656538994.issue9884@psf.upfronthosting.co.za>
In-reply-to
Content
OS: Windows 2003STD x64 en

I have try to call python method from c++ dll by "WINFUNCTYPE".
But the 4th parameter is always None or 0 if the type is int or void* (float is works fine).

Following is the part of source code:
==code==========================================
import sys
from ctypes import *

windll.LoadLibrary("testPy2.dll")
#########################################

def test3(param1,param2,param3,param4,param5,param6,param7,param8,param9,param10):
  print("================")
  print(param1)
  print(param2)
  print(param3)
  # the 4th param4 is always 0.
  print(param4)
  print(param5)
  print(param6)
  print(param7)
  print(param8)
  print(param9)
  print(param10)
  print("================")
  return 20
  
C_METHOD_TYPE4 = WINFUNCTYPE(c_int32, c_int32, c_int32, c_int32, c_int32, c_int32, c_int32, c_int32, c_int32, c_int32, c_int32)

windll.testPy2.fntestPy7(9,C_METHOD_TYPE4(test3))
==code==========================================

To my knowledge, both visual c++ and gcc use registers for the first few parameters, and then after that use the stack.  Maybe this is the reason.

I have attached some simple codes for reproduce this issue.
issues
  - testPy2      <- source code of the dll
  - test.py      <- python file to reproduce the issue
  - testPy2.dll  <- the dll to reproduce the issue
History
Date User Action Args
2010-09-17 09:12:22owenlsetrecipients: + owenl
2010-09-17 09:12:22owenlsetmessageid: <1284714742.48.0.856656538994.issue9884@psf.upfronthosting.co.za>
2010-09-17 09:11:56owenllinkissue9884 messages
2010-09-17 09:11:55owenlcreate