[Expat-bugs] [ expat-Bugs-1476160 ] __cdecl shouldn't be selected by use of MS extensions

SourceForge.net noreply at sourceforge.net
Fri Jun 2 11:23:22 CEST 2006


Bugs item #1476160, was opened at 2006-04-25 14:17
Message generated for change (Comment added) made by mighty_toenail
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=110127&aid=1476160&group_id=10127

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Build control
Group: Platform Specific
Status: Open
Resolution: Accepted
Priority: 5
Submitted By: Mighty Toenail (mighty_toenail)
Assigned to: Karl Waclawek (kwaclaw)
Summary: __cdecl shouldn't be selected by use of MS extensions

Initial Comment:
Expat 2.0.0

I find that in my builds _MSC_EXTENSIONS is not
defined, probably because I build with Microsoft
extensions switched off. The result of this is that
XMLCALL does not get defined to __cdecl, so when I try
to link to a __fastcall project I can't resolve the
symbols.

My workaround has been to change expat_external.h as
follows:

#if defined(XML_USE_MSC_EXTENSIONS)
#define XMLCALL __cdecl

becomes

#if defined(XML_USE_MSC_EXTENSIONS) || defined (_WIN32)
|| defined (_WIN64)
#define XMLCALL __cdecl

which is easy to apply and good enough for my purposes.

I am not a Windows expert, so there may be better ways,
e.g. a symbol that encompases both _WIN32 and _WIN64.
However, I think that you should be specifying the
Windows calling convention based on whether you are
building on Windows, not on whether you are building
with Microsoft extensions. XML_USE_MSC_EXTENSIONS is
used in other places in your code, but perhaps in these
other places it really is appropriate to make the
decision based on whether MS extensions are switched on
(again, I'm not a Windows expert so I'm not sure).


----------------------------------------------------------------------

>Comment By: Mighty Toenail (mighty_toenail)
Date: 2006-06-02 09:23

Message:
Logged In: YES 
user_id=1509690

Sounds good to me - I'm pretty sure I've seen _MSC_VER used
in just this manner in other code, so it's likely a sensible
thing to do.

----------------------------------------------------------------------

Comment By: Karl Waclawek (kwaclaw)
Date: 2006-06-01 21:04

Message:
Logged In: YES 
user_id=290026

If you have no objections I'll commit the fix I described in
my last message.

----------------------------------------------------------------------

Comment By: Karl Waclawek (kwaclaw)
Date: 2006-05-26 16:11

Message:
Logged In: YES 
user_id=290026

Does it work for you to use
  #if defined(_MSC_VER) 
instead of
  #if defined(XML_USE_MSC_EXTENSIONS) ?

Looking at the other instances of
 #if defined(XML_USE_MSC_EXTENSIONS) 
I think they might be OK.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=110127&aid=1476160&group_id=10127


More information about the Expat-bugs mailing list