Billy N. Patton <[EMAIL PROTECTED]> writes:
>Silvo,
>   This group chooses to help only other experts.  Beginners are not 
>welcome here. I've ask several questions about C++ and have recieved no 
>response.  Guess my questions were too trivial. Too obvious to an 
>expert.  Too far below them to answer.

That is not true. To far above us. 

Perl isn't written in C++ it is written in C, so the perl core experts 
tend not to be C++ experts (e.g. I am probably one of strongest XS 
experts on this list, but an am only at best competent in C++ and 
templates and finer point of STL give me nightmares).

C++ is much more complex than C to wrap.

I have a scheme for day-job (which is currently encumbered and can't 
yet be released) which has over 2000 lines of perl to implement a 
tiny subset of C++ parsing sufficent to do "h2xs" equivalent for 
our day-job C++ library. 

It has to understand:
  name spaces
  struct vs class
  public vs protected
  inheritance
  overloaded functions
  operators 
  templates and instances thereof.

It can't wrap all those yet, but unless the "parser" can at least 
basically grasp the constructs it rapidly gets lost in the .h file.
A C++ class in a .h  _has_ to mention all the private stuff 
and typically includes inline functions which have to be skipped over
etc.

And FWIW I never use h2xs for C code as it is much safer to write 
bindings by hand as XS code and even the relatively trivial task 
of parsing C declarations is often "wrong".

>
>SilvioCVdeAlmeida wrote:
>> Hello,
>> 
>> How suitable is h2xs for generating C++Perl bindings? I couldn't manage
>> it to work as I expected.
>> 
>> I'm trying to build a Perl module to access a C++ library, closely
>> following "Extension based on .h and .c files" from h2xs manpage:
>> 
>> 1. start dirs:
>>    h2xs -Afn Pack
>> 2. copy .h and .c (.cc in my case) to Pack/
>> 3. create extension:
>>    h2xs -Oxan Pack head_1.h head2.h
>> 4. archive and test:
>>    cd Pack
>>    perl Makefile.PL
>>    make dist
>>    make
>>    make test
>> 
>> It breaks in make test, because generated Pack.c (-- not Pack.cc as I
>> wanted --) ask for C compilation, which do not find iostream, string,
>> and other standard C++ headers.
>> 
>> Any help would be very appreciated.
>> 
>> Silvio

Reply via email to