From: Andrew G. <And...@np...> - 2002-12-30 15:14:55
|
I am writing a Python extension (a DLL) in C++ which itself uses functions from within a commercial DLL (IEEE_32M.DLL). Most of the functions work, but one of the functions (receive) causes an "invalid page fault" apparently from within the DLL. I'm using GCC-3.2.1 and have already found that the code works with Borland C++. The cause of the problem may be related to the fact that receive is the only function that returns a string. A similar function "transmit" for sending a string works ok. From the header file for the DLL supplied by the manufacturer: extern "C" { extern long int _cdecl ieee488_receive (char *,unsigned long,unsigned long *,long int *); } #define receive(s,maxlen,len,status) ieee488_receive((char *) (s),maxlen,(unsigned long *) len,(long int *) status) \\ In my code: long int status; long int GPIB_NCharReceived; char *Work; Work = new char[256]; long int maxlen = 255; \\ The call looks like this receive(Work,maxlen,&GPIB_NCharReceived,&status); From the IEEE_32M.DEF created using pexports (extract only gives receive function for brevity) LIBRARY IEEE_32M.DLL EXPORTS DllMain IEEE488_RECEIVE _ieee488_receive _ieee_receive@16 ieee488_receive I've tried a variety of compiler/ linker options but with no luck. Currently: extra_compile_args=['-O0','-march=i586','-malign-double'], extra_link_args=['-mthread','-mms-bitfields'], Does anyone have any ideas? Andrew. ------------------------------------------------------------------- This e-mail and any attachments may contain confidential and/or privileged material; it is for the intended addressee(s) only. If you are not a named addressee, you must not use, retain or disclose such information. NPL Management Ltd cannot guarantee that the e-mail or any attachments are free from viruses. NPL Management Ltd. Registered in England and Wales. No: 2937881 Registered Office: Teddington, Middlesex, United Kingdom TW11 0LW. ------------------------------------------------------------------- |