Ticket #12 (closed defect: fixed)

Opened 5 years ago

Last modified 5 years ago

__stdcall define wrong for Windows platform

Reported by: JimKleckner Owned by: somebody
Priority: critical Milestone: 0.9.8.1
Component: Code Generation Keywords:
Cc:

Description

The previous patch that fixed the redefinition of __stdcall on Cygwin caused the Windows platform to fail to recognize the calling convention.

The attached patch adds a check for MS_WINDOWS as well before __stdcall is turned off.

Attachments

stdcall.hg Download (1.0 KB) - added by JimKleckner 5 years ago.
Mercurial patch for __stdcall
windows.jek.patch Download (1.3 KB) - added by JimKleckner 5 years ago.
Updated patch

Change History

Changed 5 years ago by JimKleckner

Mercurial patch for __stdcall

Changed 5 years ago by robertwb

I'm not quite sure I understand--if MS_WINDOWS is defined, then isn't stdcall defined as well?

Changed 5 years ago by JimKleckner

  • summary changed from !__stdcall define wrong for Windows platform to __stdcall define wrong for Windows platform

Correct.

That is why the stub for __stdcall is protected by an

#ifndef MS_WINDOWS

so that it won't blow it away in that case.

The issue is that Python.h doesn't include <windows.h> so that when the conditions are processed, __stdcall will not yet be defined. In that case, we need to protect it with the platform define.

In the DllMain? embedding I'm playing with, I explicitly include windows.h which then causes it to become defined. Without the protection of MS_WINDOWS, it has already been made into an empty string value.

Changed 5 years ago by JimKleckner

I just spent a couple of hours tracking down a linkage problem after updating my tool chain because I forgot about this patch that never got applied.

One can argue that this is major if you are trying to build something on Windoze because linkage fails.

Please either apply the patch or tell my why you won't.

Changed 5 years ago by JimKleckner

Attached is an updated patch that also defines _USE_MATH_DEFINES so that M_PI and such will get defined as with the standard math.h.

Changed 5 years ago by JimKleckner

Updated patch

Changed 5 years ago by robertwb

  • priority changed from minor to critical

Changed 5 years ago by robertwb

  • status changed from new to closed
  • resolution set to fixed

Sorry it has taken so long, I don't have Windows to test this on, and no one has stepped up to do the same. (Also, it was marked as "minor" so it slipped under the radar for a while.)

Thank you for the patch, it's in now.

Changed 5 years ago by robertwb

  • milestone set to 0.9.8.1
Note: See TracTickets for help on using tickets.