[ expat-Bugs-413653 ] XMLPARSERAPI and __cdecl

noreply@sourceforge.net noreply@sourceforge.net
Fri, 27 Jul 2001 13:43:10 -0700


Bugs item #413653, was opened at 2001-04-04 01:00
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=110127&aid=413653&group_id=10127

Category: Build control
Group: Platform Specific
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Matthew Versluys (styxlord)
Assigned to: Fred L. Drake, Jr. (fdrake)
Summary: XMLPARSERAPI and __cdecl

Initial Comment:
If before including expath.h XMLPARSERAPI is defined 
to __declspec(dllimport) __cdecl which is required if 
you are building a project with fastcall calling 
convention the following errors result.

expat.h(548) : error C2165: 'left-side modifier' : 
cannot modify pointers to data
expat.h(574) : error C2165: 'left-side modifier' : 
cannot modify pointers to data
expat.h(689) : error C2165: 'left-side modifier' : 
cannot modify pointers to data
Include\expat.h(702) : error C2165: 'left-side 
modifier' : cannot modify pointers to data
Include\expat.h(706) : error C2165: 'left-side 
modifier' : cannot modify pointers to data

Which is the result of the XMLPARSEAPI definition 
apearing between the return type and the * modifier 
indicating that the return type is a pointer.  By 
moving XMLPARSEAPI to the right hand side of the * 
modifier the problem is resolved.

This is using expat_win32bin 1.95.1 with Microsoft 
Visual Studio 6.0 SP4.

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

>Comment By: Fred L. Drake, Jr. (fdrake)
Date: 2001-07-27 13:43

Message:
Logged In: YES 
user_id=3066

Ok, I've fixed this for version 1.95.2, to be released as soon as I can get the files in place.

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

Comment By: Fred L. Drake, Jr. (fdrake)
Date: 2001-07-25 13:45

Message:
Logged In: YES 
user_id=3066

--sigh--

This appears to be a no-win game.  ;-(  Other problems cropped up when I tried always placing XMLPARSEAPI on the right of the type.

For the Python interpreter, we use a slightly different approach; we have a macro that takes a type as a parameter, and that allows add __foo annotations to both sides of the type.  But both approaches make the source really heinous to read.

I'm going to have to think about this one a little bit.

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

Comment By: Fred L. Drake, Jr. (fdrake)
Date: 2001-04-04 18:39

Message:
Logged In: YES 
user_id=3066

Assigned to Clark since he'll probably understand this one before I do.  (I really need to learn more about development under Windows...)

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

Comment By: Matthew Versluys (styxlord)
Date: 2001-04-04 01:10

Message:
Logged In: YES 
user_id=188602

Of course, now that I'm awake this doesn't produce the 
desired result anyhow since it now ignores the __declspec
(dllimport) for those functions.  The real fix is the have 
an XMLPARSEDECL definition which appears before the return 
arguments to the functions which is where the __declspec
(import) belongs and the __cdecl is used with XMLPARSEAPI.

The expat_win32bin 1.95.1 package doesn't include an import 
library so the functions need to be manually bound using 
LoadLibrary, GetProcAddress anyhow.

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

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