The problem was precidence of header files within the
xs file:

#ifdef __cplusplus
extern "C" {
#endif

#include <malloc.h>
#include <unistd.h>
#include <myheader.h>
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include "ppport.h"
#ifdef __cplusplus
}
#endif

did not work, but:

#include <myheader.h>

#ifdef __cplusplus
extern "C" {
#endif

#include <malloc.h>
#include <unistd.h>
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include "ppport.h"
#ifdef __cplusplus
}
#endif

did!

There must have been conflicts within the perl and C++
headers.


--- Chris Masters <[EMAIL PROTECTED]> wrote:
> Sorry about this.
> 
> I've fixed my header problem and the C++ test code
> works.
> 
> I'm still having the original problem, so back to
> square one:
> 
> >If FunctionName is a C function have you declared
> it
> >as extern "C"?
> >Compiling XS with g++ means function names get
> mangled
> 
> Can anyone explain this some more? 
> 
> The working XS module links to a header with
> functions
> declared as extern "C".
> 
> The disfunctional one does not. I assume they are
> implemented as C++ functions.
> 
> The error again:
> 
> perl: relocation error: <long list> undefined
> symbol:
> FunctionName
> 
> 
> Any ideas?
> 
> I will fix this!!!
> 
> Chris
> 
> 
> --- Chris Masters <[EMAIL PROTECTED]> wrote:
> > It was the header file format.
> > 
> > I had used dos2unix to convert the format of the
> > header into something readable in vi, but this
> must
> > have changed the format of the header file
> somehow.
> > 
> > I placed the original dos formatted header file
> into
> > /usr/include and it worked.
> > 
> > Thanks for you help Nick.
> > 
> > 
> > --- Chris Masters <[EMAIL PROTECTED]> wrote:
> > > UPDATE - It's not a perl issue.
> > > 
> > > > > >1 - I know the static (.a) C++ library
> works
> > > > > because I
> > > > > >can compile and run programs that use it.
> > > > > 
> > > > > Any chance .a file was _in_ that directory.
> > > > > 
> > > > 
> > > > It was. I'll check if this works otherwise.
> > > >
> > > 
> > > If I move the test cpp to /tmp and try and
> > compile,
> > > it
> > > fails. The header file is located in
> /usr/include.
> > > 
> > > It succeeds if I move the header file into /tmp.
> > > 
> > > So this isn't a perl-XS issue!!
> > > 
> > > However, why would linking fail if the header is
> > in
> > > /usr/include??
> > > 
> > > 
> > > 
> > > 
> > > 
> > > __________________________________
> > > Do you Yahoo!?
> > > Yahoo! Hotjobs: Enter the "Signing Bonus"
> > > Sweepstakes
> > >
> http://hotjobs.sweepstakes.yahoo.com/signingbonus
> > 
> > 
> > __________________________________
> > Do you Yahoo!?
> > Yahoo! Hotjobs: Enter the "Signing Bonus"
> > Sweepstakes
> > http://hotjobs.sweepstakes.yahoo.com/signingbonus
> 
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Hotjobs: Enter the "Signing Bonus"
> Sweepstakes
> http://hotjobs.sweepstakes.yahoo.com/signingbonus


__________________________________
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus

Reply via email to