PromiseFlatString is not part of the frozen Gecko API. You should only use it if you are happy having your code be tightly coupled to the version of Mozilla you are compiling against. It looks to me as if you are building against Mozilla 1.7 or later. I recommend downloading the latest Gecko SDK from the Mozilla 1.7 branch:
ftp://ftp.mozilla.org/pub/mozilla.org/mozilla/nightly/latest-1.7/gecko-sdk-i586-pc-msvc.zip


Instead, if you want compatibility with more than one version of Mozilla, you should select a version of the Gecko SDK that matches the oldest version of Mozilla that you wish to support.

When compiling your code you should make sure and define MOZILLA_STRICT_API, and then link against the import libraries provided by the Gecko SDK. Make sure your code is only using frozen symbols from the XPCOM library. (Look for @status FROZEN in the header files.)

Also, if you are using the latest 1.7 Gecko SDK, then you might try using the NS_StringGetData function to get a pointer to the nsAString's internal buffer (the function also returns the internal buffer's length).

See also: http://developer-test.mozilla.org/xpcom/api/

-Darin



Eugene Mironichev wrote:

Hi,

I am trying to modify and compile npsimple.dll XPCOM sample with VC6
and Gecko SDK. I need to convert nsAString into VC6's type _bstr_t
using nsPromiseFlatString function:

NS_IMETHODIMP nsScriptablePeer::StoreString(const nsAString & str)
{
_bstr_tMyString = PromiseFlatString(str);
}

Compiler makes no errors but VC6 linker show these errors:
-------------------------
nsScriptablePeer.obj : error LNK2001: unresolved external symbol
"private: void __thiscall nsPromiseFlatString::Init(class nsAString
const &)" ([EMAIL PROTECTED]@@AAEXABVnsAString@@@Z)

nsScriptablePeer.obj : error LNK2001: unresolved external symbol
"public: static unsigned short const * const nsCharTraits<unsigned
short>::sEmptyBuffer" ([EMAIL PROTECTED]@G@@2PBGB)

nsScriptablePeer.obj : error LNK2001: unresolved external symbol
"public: static void const * const nsObsoleteAString::sCanonicalVTable"
([EMAIL PROTECTED]@@2PBXB)

nsScriptablePeer.obj : error LNK2001: unresolved external symbol
"public: __thiscall nsAString::~nsAString(void)" (??1nsAString@@[EMAIL 
PROTECTED])
-------------------------

Can anyone please help my? It seems like I have to link some .LIB but I
am not able to find .lib required by nsPromiseFlatString.h
sincerely, Eugene Mironichev
http://www.bytescout.com/

_______________________________________________
Mozilla-xpcom mailing list
[EMAIL PROTECTED]
http://mail.mozilla.org/listinfo/mozilla-xpcom



_______________________________________________ Mozilla-xpcom mailing list [EMAIL PROTECTED] http://mail.mozilla.org/listinfo/mozilla-xpcom

Reply via email to