Thanks Darin!  This is a great help!

I'm not sure that I can switch to nsEmbedString since the application
(Sun ONE Calendar server) is already written using nsStrings.  Would I
be able to use nsEmbedString without redefining the function calls,
which are now using nsStrings?


So because of this I went back to trying to compile with your new
insights about my not referencing the xpcom shared lib.

I looked around for libxpcom on the system using find and found one. 
I modified my compile statement.  I had to gradually add more and more
links until I finally had this (kludge):

-------------------
g++ \
-L/usr/lib -lCrun \
-L/usr/dt/appconfig/SUNWns6 -lldap40 -lxpcom -llber40 \
-L/opt/SUNWics5/cal/bin \
-licsexp10 \
-lcsapi_xpcom10 \
-lmailwave \
-lmee \
-lcyrus \
-lyasr \
-lasync \
-lchartable \
-lnsres31 -lnsfmt31 -lnsuni31 -lnscnv31 -lnsbrk31 -lnscol31 \
-ladminutil -ldb26 -lldap40 -lnspr3 -lplds3 -lplc3 \
-I/opt/SUNWics5/cal/csapi/include \
-I/opt/SUNWics5/cal/csapi/include/include \
-R/opt/SUNWics5/cal/bin:/usr/dt/appconfig/SUNWns6:/usr/local/lib \
-g t.cpp \
-Wno-deprecated
----------------------


Whew!

I uncommented "nsString a;" and, to my horror, saw the same ld error!

So, I tried running "nm" on the lib, with this result:

------------------------------------------------
> nm /usr/dt/appconfig/SUNWns6/libxpcom.so


/usr/dt/appconfig/SUNWns6/libxpcom.so:
------------------------------------------------

that's it... nothing.

Might I have a corrupt lib file?  (Or am I just chasing my tail?  I'm
really winging it here, I must admit.)


On the other hand if I run: strings -a
/usr/dt/appconfig/SUNWns6/libxpcom.so | grep ToCString    (ToCString
is defined my copy of nsString.h)
 -> 
__1cJnsCStringJToCString6kMpcII_1_
__1cInsStringJToCString6kMpcII_1_

so it seems like the symbols are there... I'm not sure why nm doesn't
detect them.

Is there a way to download/compile another copy of libxpcom.so?




Darin Fisher <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
> Eric wrote:
> 
> >(I apologize in advance if this post isn't related closely enough to
> >the topic of this group.)
> >
> >
> >I've been trying to modify some code that involves nsString variables.
> >I'm having trouble just compiling the code.
> >
> >I've chopped the C++ code down to just:
> >
> >-----------------------------------------------------
> >#include "nspr.h"
> >#include "nsString.h"
> >
> >main() {
> >  nsString aVendorName;
> >}
> >-----------------------------------------------------
> >
> >
> >  and I'm trying to compile it with:
> >
> >-----------------------------------------------------
> >g++ \
> >-L/opt/SUNWics5/cal/bin \
> >-licsexp10 -lcsapi_xpcom10 -lmailwave -lmee -lcyrus \
> >-lyasr -lasync -lchartable \
> >-lnsres31 -lnsfmt31 -lnsuni31 -lnscnv31 -lnsbrk31 -lnscol31 \
> >-ladminutil -ldb26 -lldap40 -lnspr3 -lplds3 -lplc3 \
> >-I/opt/SUNWics5/cal/csapi/include \
> >-I/opt/SUNWics5/cal/csapi/include/include \
> >-R/opt/SUNWics5/cal/bin:/usr/local/lib \
> >-g t.cpp \
> >-Wno-deprecated
> >-----------------------------------------------------
> >
> >  which returns:
> >
> >-----------------------------------------------------
> >Undefined                       first referenced
> > symbol                             in file
> >nsString::nsString[in-charge]()     /var/tmp//ccsNzmyv.o
> >nsString::~nsString [in-charge]()   /var/tmp//ccsNzmyv.o
> >ld: fatal: Symbol referencing errors. No output written to a.out
> >collect2: ld returned 1 exit status
> >-----------------------------------------------------
> >
> >  Does anyone happen to know what I'm doing wrong or how I'd debug
> >this?
> >
> >Thank you.
> >
> >Eric
> >_______________________________________________
> >Mozilla-xpcom mailing list
> >[EMAIL PROTECTED]
> >http://mail.mozilla.org/listinfo/mozilla-xpcom
> >  
> >
> 
> It looks like you need to link to the implementation of nsString.  You 
> can solve this problem in a number of ways.  One simple solution is to 
> link against libxpcom.so since it will contain the missing symbols.  
> However, this will tie your application to that specific version of 
> libxpcom.so since there is no guarantee that future versions of 
> libxpcom.so will export the same symbols.
> 
> If you want a solution that works with future versions of Mozilla, then 
> I suggest using nsEmbedString in place of nsString.
> 
> -Darin
_______________________________________________
Mozilla-xpcom mailing list
[EMAIL PROTECTED]
http://mail.mozilla.org/listinfo/mozilla-xpcom

Reply via email to