Closed Bug 682259 Opened 13 years ago Closed 13 years ago

Problem linking code with XulRunner SDK 7.0

Categories

(Firefox :: Extension Compatibility, defect)

7 Branch
x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: sergeavel, Unassigned)

Details

(Keywords: dev-doc-complete)

User Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.215 Safari/535.1

Steps to reproduce:

I have extension that supports multiples version of FF (3.6-6) and contains native code. I have tried to recompile my native code using latest xulrunner 7.0 SDK (http://download02.mozilla.org/pub/mozilla.org/xulrunner/nightly/latest-mozilla-beta/).

I have compiled my code via VS 2008 with following xulrunner libs included for linker (the same as with previous version of xulrunner)

xpcom.lib
xpcomglue_s_nomozalloc.lib
nspr4.lib


Actual results:

Compilation stage completed successfully but linking failed with fallowing errors


Error	3	error LNK2019: unresolved external symbol "public: unsigned short const * __thiscall nsAString::BeginReading(void)const " (?BeginReading@nsAString@@QBEPBGXZ) referenced in function "public: unsigned short const * __thiscall nsString_external::get(void)const " (?get@nsString_external@@QBEPBGXZ)	ENmozUtils.obj	enbar
Error	4	error LNK2001: unresolved external symbol "public: unsigned short const * __thiscall nsAString::BeginReading(void)const " (?BeginReading@nsAString@@QBEPBGXZ)	ENTool.obj	enbar
Error	5	error LNK2019: unresolved external symbol "public: int __thiscall nsAString::FindChar(unsigned short,unsigned int)const " (?FindChar@nsAString@@QBEHGI@Z) referenced in function "class nsString_external & __cdecl ReplaceDoubleQuotes(class nsString_external &)" (?ReplaceDoubleQuotes@@YAAAVnsString_external@@AAV1@@Z)	ENmozUtils.obj	enbar
Error	6	error LNK2019: unresolved external symbol "public: unsigned short const * __thiscall nsAString::EndReading(void)const " (?EndReading@nsAString@@QBEPBGXZ) referenced in function "unsigned int __stdcall MakeBody(class nsIDOMWindow *,class nsIDOMHTMLDocument *,class nsString_external &,unsigned short * * *,unsigned int *,int)" (?MakeBody@@YGIPAVnsIDOMWindow@@PAVnsIDOMHTMLDocument@@AAVnsString_external@@PAPAPAGPAIH@Z)	ENmozUtils.obj	enbar



Expected results:

I have read "Firefox 7 for developers" article and have not found any changes in nsAString class, so I think my code should be linked without any problems (or changes in nsAString should be listed in the article mentioned above)
Could this be because of the patch in bug 540322?
I have this same issue, but only on Windows.  The signature of the function in the referenced libs changed between Gecko 6.0 and Gecko 7.0:

d:\gecko_6.0\win\lib>dumpbin /symbols *.lib | findstr /i BeginReading
036 00000000 UNDEF  notype ()    External     | ?BeginReading@nsAString@@QBEPBGXZ (public: unsigned short const * __thiscall nsAString::BeginReading(void)const )
...

d:\gecko_7.0\win\lib>dumpbin /symbols *.lib | findstr /i BeginReading
036 00000000 UNDEF  notype ()    External     | ?BeginReading@nsAString@@QBEPB_WXZ (public: wchar_t const * __thiscall nsAString::BeginReading(void)const )
...
Status: UNCONFIRMED → NEW
Ever confirmed: true
This is probably fallout from bug 508905; try not using -Zc:wchar_t- in the cl.exe command line? For those using the Visual Studio projects, I believe it's Project Properties -> C/C++ -> Language -> Treat wchar_t as Built-in Type -> Yes.

Marking as dev-doc-needed even though that should really go on bug 508905.
Keywords: dev-doc-needed
Okay, removing -Zc:wchar_t- does indeed seem to fix the linker error.  I will update our build scripts.  Thanks.
Calling this fixed, but still pending documentation.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Added a note about this change here:

https://developer.mozilla.org/En/Developer_Guide/Build_Instructions#Build_and_install

And added a mention to Firefox 7 for developers.
Sorry, but I have the same problem (linker error) with xul-runner 10.0.2:
...
Error	24	error LNK2019: unresolved external symbol "public: unsigned short const * __thiscall nsAString::BeginReading(void)const " (?BeginReading@nsAString@@QBEPBGXZ) referenced in function "public: unsigned short const * __thiscall nsString_external::get(void)const " (?get@nsString_external@@QBEPBGXZ)	embed.obj	HTMLRenderer
...

And in my VS project settings the option 'Treat wchar_t as Built-in Type' is set to 'yes'.
(In reply to Friedemann Kunze from comment #7)
> Sorry, but I have the same problem (linker error) with xul-runner 10.0.2:
> ...
> Error	24	error LNK2019: unresolved external symbol "public: unsigned short
> const * __thiscall nsAString::BeginReading(void)const "
> (?BeginReading@nsAString@@QBEPBGXZ) referenced in function "public: unsigned
> short const * __thiscall nsString_external::get(void)const "
> (?get@nsString_external@@QBEPBGXZ)	embed.obj	HTMLRenderer
> ...
> 
> And in my VS project settings the option 'Treat wchar_t as Built-in Type' is
> set to 'yes'.

Hi there.
I have exactly the same problem as you.
Did you manage to find any solution?
You need to log in before you can comment on or make changes to this bug.