Closed Bug 340275 Opened 16 years ago Closed 16 years ago

Make nsTArray available to XULRunner apps


(Toolkit Graveyard :: XULRunner, defect)

1.8 Branch
Windows XP
Not set


(Not tracked)



(Reporter: bent.mozilla, Assigned: bent.mozilla)


(Keywords: fixed1.8.1)


(1 file)

Right now I get the following link errors when using nsTArray:

unresolved external symbol "__declspec(dllimport) public: unsigned int __thiscall nsTArray_base::Length(void)const " (__imp_?Length@nsTArray_base@@QBEIXZ)
unresolved external symbol "__declspec(dllimport) protected: __thiscall nsTArray_base::nsTArray_base(void)" (__imp_??0nsTArray_base@@IAE@XZ)
unresolved external symbol "__declspec(dllimport) protected: void __thiscall nsTArray_base::ShiftData(unsigned int,unsigned int,unsigned int,unsigned int)" (__imp_?ShiftData@nsTArray_base@@IAEXIIII@Z)
unresolved external symbol "__declspec(dllimport) protected: int __thiscall nsTArray_base::EnsureCapacity(unsigned int,unsigned int)" (__imp_?EnsureCapacity@nsTArray_base@@IAEHII@Z)
unresolved external symbol "__declspec(dllimport) protected: void __thiscall nsTArray_base::IncrementLength(unsigned int)" (__imp_?IncrementLength@nsTArray_base@@IAEXI@Z) referenced in function "public: int * __thiscall nsTArray<int>::AppendElements<int>(int const *,unsigned int)" (??$AppendElements@H@?$nsTArray@H@@QAEPAHPBHI@Z)

I'm linking xpcom.lib and xul.lib and MOZILLA_INTERNAL_API is defined. I'm not sure if this is an issue on the trunk.
Try linking to xpcomglue_s.lib in addition to xpcom.lib.  You shouldn't need to link to xul.lib.
(In reply to comment #1)
> Try linking to xpcomglue_s.lib in addition to xpcom.lib.  You shouldn't need to
> link to xul.lib.
I'm using unfrozen interfaces so I hadn't tried xpcomglue_s.lib, but I still get the same unresolved externals (in addition to several others... is nsAutoLock not part of the glue?!?). Could I be missing some defines?
And I guess I should mention that this same code + linkage strategy worked fine when I was using nsVoidArray.
Okay, at the advice of bsmedberg I added nsTArray to xpcom/build/dlldeps.cpp and things work properly now. Seems that MSVC was stripping those symbols from the libs because they weren't being used. Patch in a sec.
OS: All → Windows XP
Hardware: All → PC
Attached patch patch v1.0Splinter Review
Adds some nsTArray calls to dlldeps.cpp so that msvc won't strip nsTArray symbols from export libs.
Assignee: nobody → bent.mozilla
Attachment #224746 - Flags: first-review?(benjamin)
Attachment #224746 - Flags: first-review?(benjamin) → first-review?(darin)
Attachment #224746 - Flags: first-review?(darin) → first-review+
Comment on attachment 224746 [details] [diff] [review]
patch v1.0

I always forget to request branch approval...
Attachment #224746 - Flags: approval-branch-1.8.1?(darin)
Attachment #224746 - Flags: approval-branch-1.8.1?(darin) → approval-branch-1.8.1+
fixed on trunk and branch
Closed: 16 years ago
Keywords: fixed1.8.1
Resolution: --- → FIXED
Product: Toolkit → Toolkit Graveyard
You need to log in before you can comment on or make changes to this bug.