develooper Front page | perl.perl5.porters | Postings from January 2015

Re: khw's PL_charclass Re: c++ builds are not possible withanycompiler,Encode::Byte

Thread Previous | Thread Next
From:
bulk88
Date:
January 25, 2015 05:08
Subject:
Re: khw's PL_charclass Re: c++ builds are not possible withanycompiler,Encode::Byte
Message ID:
BLU436-SMTP1676B3E23252270748495F9DF340@phx.gbl
bulk88 wrote:
> Steve Hay wrote:
>> As noted before, we also have a problem with PL_interp_size and
>> PL_interp_size_5_18_0 getting mangled. The attached patch fixes them
>> for me.
>>
>> I will pursue a solution in EXTERN.h to cover all cases sometime since
>> that's a better approach if it works, but I don't have time right now.
>> If anyone else wants to do this in the meantime then feel free :-)
>>
> 
> Im trying something different from your patch. Making 
> START_EXTERN_C/END_EXTERN_C unnecessary for all global data 
> declarations. This allows global vars to be declared/defined from 
> anywhere in perls headers instead of just specific areas (either 
> specific .h'es or in START_EXTERN_C/END_EXTERN_C blocks), as khw and 
> others in this thread said earlier. This patch isn't compiling for me 
> ATM but I plan to work on it.
> 


Patch attached, it isn't commit ready due to no message body and bad 
comments. This patch removes the need for global vars to remember to use 
START_EXTERN_C/END_EXTERN_C. Tested on (Win32 GCC|Win32 
VC)*(C|C++)*(threaded|unthreaded) with no build errors, and probably no 
test fails (tests are failing on my end, but due to other WIPs).

VC C++ is fine with "__declspec(dllexport) EXTERN_C", but GCC C++ syntax 
errors with "__declspec(dllexport) EXTERN_C" so I had to use "EXTERN_C 
__declspec(dllexport)". __declspec(dllexport) expands to "__attribute__ 
((dllexport))" on Mingw GCC.


The PERLVAR/PERLVARA stuff is because

/* in C this declares and defines a body for an unmangled C var */
U32 PL_somevar;

/* in C++ this declares and defines a body for a mangled C++ var */
U32 PL_somevar;

/* in C++ this declares but does not define a body for an unmangled C var */
extern "C" U32 PL_somevar;

/* how do we define a body for the unmangled C var from C++ ? apparently 
like this (I am not a C++ guru but it works)*/
extern "C" U32 PL_somevar;
U32 PL_somevar;


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About