Make binary components work with a static build (Windows)

RESOLVED INCOMPLETE

Status

()

Firefox
General
RESOLVED INCOMPLETE
8 years ago
8 years ago

People

(Reporter: joelr, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

8 years ago
No idea how to approach this one. Need to get a Windows static build going first.
(Reporter)

Updated

8 years ago
Depends on: 532771
(Reporter)

Updated

8 years ago
Assignee: nobody → joelr
(Reporter)

Comment 1

8 years ago
Any suggestions on how to make this work on Windows in the style of bug 532531 (Mac)?

Comment 2

8 years ago
(In reply to comment #1)
> Any suggestions on how to make this work on Windows in the style of bug 532531
> (Mac)?

What you're doing there requires a similar set of steps on windows. But I sense this is a broader issue, from your first post on the other bug -

(In reply to comment #0)
> Components are not able to link against dynamic libraries anymore but still
> need string handling and other functionality now living within Firefox.

so with static builds, there are apis buried in firefox.exe that component developers need access to? Looking at my electrolysis build, it looks like everything is exported from xul.dll.

Comment 3

8 years ago
The whole point of this is that there are few or no DLLs (no xul.dll).
(Reporter)

Comment 4

8 years ago
> so with static builds, there are apis buried in firefox.exe that component
> developers need access to?

That's absolutely right. Works on Mac OSX, I'm currently trying to figure this out on Linux. Unfortunately, I'm the least qualified person to look into this on Windows, will likely spend until the end of the year just learning Windows programming :-(. Your help is appreciated!
(Reporter)

Comment 5

8 years ago
Bug 532769 confirms that Linux works about the same as Mac OSX. Windows is still a mistery.

Comment 6

8 years ago
(In reply to comment #3)
> The whole point of this is that there are few or no DLLs (no xul.dll).

I see so we are looking at a new form of build config for this? FWIW, you can export entry points from exes just like dlls -

-- host exporttest.exe --

#include "plugin.h"
#pragma comment(lib, "plugin")

__declspec(dllexport) void pong() {
  printf("pong\n");
}

int _tmain(int argc, _TCHAR* argv[])
{
  ping();
  return 0;
}

-- plugin --

#pragma comment(lib, "exporttest")
#include "exporttest.h"

__declspec(dllexport) void ping() {
  printf("ping\n");
  pong();
}

-- output --

ping
pong

Comment 7

8 years ago
Jim, does that require the component to load firefox.exe explicitly by name? How does it get linked? Is there an import library created when you create firefox.exe?
(Reporter)

Comment 8

8 years ago
Also, is there a way to make this work -without- the host referring to the plugin via #pragma comment(lib, "plugin")? Firefox as the host won't know about the plugins it will load.

Comment 9

8 years ago
(In reply to comment #7)
> Jim, does that require the component to load firefox.exe explicitly by name?
> How does it get linked? Is there an import library created when you create
> firefox.exe?

Yes, there's a lib stub generated for exes.

(In reply to comment #8)
> Also, is there a way to make this work -without- the host referring to the
> plugin via #pragma comment(lib, "plugin")? Firefox as the host won't know about
> the plugins it will load.

I'm sure we load components / plugins via LoadLibrary/GetProcAddress calls because obviously firefox doesn't link to 3rd party components.
(Reporter)

Comment 10

8 years ago
I meant to say that it has to work without #pragma comment(lib, "plugin") because Firefox won't know about the various plugins at compile time. The plugins have the same entry point but different names and it seems that the pragma hardcodes the plugin at compile time.

Can the same host load plugin1, foobar, etc. as plugins, or just plugin as per the pragma? What am I missing?

Comment 11

8 years ago
So the conclusion seems to be that without some trickery on our end, automatic fallback to the exe's exports isn't possible. There are ways around this via our own code (dll stubs that forward to the exe would be the simplest, or manual linking via import address table changes in the component dll) but I haven't found anything that would do this for us.
(Reporter)

Comment 12

8 years ago
I may have missed something but I don't see how Windows behaves differently from Mac OSX here. The latter needs the -bundle_loader flag to supply the executable with the symbols that the bundle (shared library) will be calling. 

This does not seem to be much different from having a library stub for firefox.exe and linking DLLs against it. The only Windows issue seems to be the hardcoding of the dependency on firefox.exe, which would prevent 'plugins' from being loaded into another host.

What am I missing?

Comment 13

8 years ago
(In reply to comment #12)
> I may have missed something but I don't see how Windows behaves differently
> from Mac OSX here. The latter needs the -bundle_loader flag to supply the
> executable with the symbols that the bundle (shared library) will be calling. 
> 
> This does not seem to be much different from having a library stub for
> firefox.exe and linking DLLs against it. The only Windows issue seems to be the
> hardcoding of the dependency on firefox.exe, which would prevent 'plugins' from
> being loaded into another host.
> 
> What am I missing?

Components can link to platform library stubs of various types, including xul, xpcomglue, nspr, and xpcom.

https://developer.mozilla.org/en/Gecko_SDK

The sdk has lib stubs for mozilla platform libraries. With what you are trying to do components developed with previous versions of this sdk would not load properly because none of these dlls would be available. Developers could get this to work by linking to a new sdk with the firefox lib, but that then wrecks the cross app development aspects as well as compat with older versions of our apps.

A partial solution here might be to package all of platform in a single dll and have developers link to that, or create forwarding stubs that sit in the app directory but are only loaded when needed by a component. Firefox wouldn't be effected.

You mention 'plugins' as well, when someone says 'plugin' I think of display plugins that use the Gecko plugin apis (flash for example):

https://developer.mozilla.org/en/Gecko_Plugin_API_Reference:Preface

These comprise stand alone dlls with known entry point. Afaik, they don't link to anything in platform. These would load just as they do now. (bsmedberg or jst could confirm this.)
(Reporter)

Comment 14

8 years ago
I meant binary components when I said plugins, my apologies. 

Yes, we'll be breaking binary compatibility with components developed with previous versions of the SDK. Developers will need to recompile and link against the Firefox lib. I don't see another way around it but the idea is that a static build gives us a > 15% boost in performance.

It's actually about 15% at the moment, the 50% I saw was a fluke of some sort. I think it will be possible to squeeze more than 15%, at least on Mac OSX.

Comment 15

8 years ago
(In reply to comment #14)
> I meant binary components when I said plugins, my apologies. 
> 
> Yes, we'll be breaking binary compatibility with components developed with
> previous versions of the SDK. Developers will need to recompile and link
> against the Firefox lib. I don't see another way around it but the idea is that
> a static build gives us a > 15% boost in performance.
> 
> It's actually about 15% at the moment, the 50% I saw was a fluke of some sort.
> I think it will be possible to squeeze more than 15%, at least on Mac OSX.

On windows, where does that 15% come from? Is it from loading all the dlls we rely on? If so, building platform into a single dll should provide the same boost and not kill cross-app development.
(Reporter)

Comment 16

8 years ago
Actually, I don't know whether there are any savings on Windows. The savings on Mac OSX come from using -mdynamic-no-pic which only works on static executables that load shared libraries, not on shared libraries themselves!
(Reporter)

Updated

8 years ago
Assignee: joelr → nobody

Comment 17

8 years ago
Created attachment 420837 [details] [diff] [review]
static libxul

Here is my WIP of a static libxul. Unfortunately, I ran out of windows/linker-fu and would appreciate some help. I have a static firefox.exe, but I'm stuck on linking components.
I'm linking components to firefox.lib. This means that components need to be modified to be MOZILLA_INTERNAL_API. Unfortunately nsACString_internal constructor wont resolve. I'm not sure how check if firefox.exe even contains the symbol since dumpbin.exe doesn't show any symbols.
(Reporter)

Comment 18

8 years ago
You shouldn't modify components to be MOZILLA_INTERNAL_API. You should have a dynamic xpcom for components to link against and a dynamic browsercomps. That's how it works right now.

Comment 19

8 years ago
thanks joel, that got me further. Now i'm up to

migration_s.lib(nsNetscapeProfileMigratorBase.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringContainerInit
migration_s.lib(nsBrowserProfileMigratorUtils.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringContainerInit
xpcomglue_s.lib(nsStringAPI.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringContainerInit
xpcomglue_s.lib(nsVoidArray.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringContainerInit
migration_s.lib(nsPhoenixProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringContainerInit
migration_s.lib(nsSeamonkeyProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringContainerInit
migration_s.lib(nsIEProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringContainerInit
migration_s.lib(nsProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringContainerInit
browserdir_s.lib(DirectoryProvider.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringContainerInit
shellservice_s.lib(nsWindowsShellService.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringContainerInit
migration_s.lib(nsDogbertProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringContainerInit
migration_s.lib(nsOperaProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringContainerInit
nsModule.obj : error LNK2019: unresolved external symbol __imp__NS_CStringContainerInit referenced in function "public: __thiscall nsCString_external::nsCString_external(void)" (??0nsCString_external@@QAE@XZ)
browser_feeds_s.lib(nsFeedSniffer.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringContainerInit
browserplaces_s.lib(nsPlacesImportExportService.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringContainerInit
browserabout_s.lib(AboutRedirector.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringContainerInit
migration_s.lib(nsNetscapeProfileMigratorBase.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringContainerFinish
migration_s.lib(nsBrowserProfileMigratorUtils.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringContainerFinish
xpcomglue_s.lib(nsStringAPI.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringContainerFinish
xpcomglue_s.lib(nsVoidArray.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringContainerFinish
migration_s.lib(nsPhoenixProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringContainerFinish
migration_s.lib(nsSeamonkeyProfileMigrator.obj) : error LNK2019: unresolved external symbol __imp__NS_CStringContainerFinish referenced in function "public: void __thiscall nsACString::Assign(class nsACString const &)" (?Assign@nsACString@@QAEXABV1@@Z)
migration_s.lib(nsIEProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringContainerFinish
migration_s.lib(nsProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringContainerFinish
browserdir_s.lib(DirectoryProvider.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringContainerFinish
shellservice_s.lib(nsWindowsShellService.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringContainerFinish
migration_s.lib(nsDogbertProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringContainerFinish
migration_s.lib(nsOperaProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringContainerFinish
nsModule.obj : error LNK2001: unresolved external symbol __imp__NS_CStringContainerFinish
browser_feeds_s.lib(nsFeedSniffer.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringContainerFinish
browserplaces_s.lib(nsPlacesImportExportService.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringContainerFinish
browserabout_s.lib(AboutRedirector.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringContainerFinish
xpcomglue_s.lib(nsVoidArray.obj) : error LNK2001: unresolved external symbol __imp__NS_StringGetData
xpcomglue_s.lib(nsTHashtable.obj) : error LNK2001: unresolved external symbol __imp__NS_StringGetData
migration_s.lib(nsIEProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_StringGetData
migration_s.lib(nsBrowserProfileMigratorUtils.obj) : error LNK2001: unresolved external symbol __imp__NS_StringGetData
unicharutil_external_s.lib(nsUnicharUtils.obj) : error LNK2001: unresolved external symbol __imp__NS_StringGetData
xpcomglue_s.lib(nsStringAPI.obj) : error LNK2001: unresolved external symbol __imp__NS_StringGetData
browser_feeds_s.lib(nsFeedSniffer.obj) : error LNK2019: unresolved external symbol __imp__NS_StringGetData referenced in function "public: unsigned int __thiscall nsAString::Length(void)const " (?Length@nsAString@@QBEIXZ)
browserplaces_s.lib(nsPlacesImportExportService.obj) : error LNK2001: unresolved external symbol __imp__NS_StringGetData
shellservice_s.lib(nsWindowsShellService.obj) : error LNK2001: unresolved external symbol __imp__NS_StringGetData
migration_s.lib(nsOperaProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_StringGetData
migration_s.lib(nsBrowserProfileMigratorUtils.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringGetData
xpcomglue_s.lib(nsStringAPI.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringGetData
xpcomglue_s.lib(nsVoidArray.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringGetData
xpcomglue_s.lib(nsTHashtable.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringGetData
migration_s.lib(nsSeamonkeyProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringGetData
migration_s.lib(nsIEProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringGetData
migration_s.lib(nsProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringGetData
migration_s.lib(nsNetscapeProfileMigratorBase.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringGetData
browser_feeds_s.lib(nsFeedSniffer.obj) : error LNK2019: unresolved external symbol __imp__NS_CStringGetData referenced in function "public: unsigned int __thiscall nsACString::Length(void)const " (?Length@nsACString@@QBEIXZ)
browserplaces_s.lib(nsPlacesImportExportService.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringGetData
migration_s.lib(nsOperaProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringGetData
migration_s.lib(nsPhoenixProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringGetData
migration_s.lib(nsIEProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringSetData
migration_s.lib(nsProfileMigrator.obj) : error LNK2019: unresolved external symbol __imp__NS_CStringSetData referenced in function "protected: __thiscall nsProfileMigrator::~nsProfileMigrator(void)" (??1nsProfileMigrator@@IAE@XZ)
xpcomglue_s.lib(nsINIParser.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringSetData
browser_feeds_s.lib(nsFeedSniffer.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringSetData
browserplaces_s.lib(nsPlacesImportExportService.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringSetData
migration_s.lib(nsOperaProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringSetData
migration_s.lib(nsSeamonkeyProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringSetData
migration_s.lib(nsProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringSetDataRange
migration_s.lib(nsBrowserProfileMigratorUtils.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringSetDataRange
xpcomglue_s.lib(nsStringAPI.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringSetDataRange
browser_feeds_s.lib(nsFeedSniffer.obj) : error LNK2019: unresolved external symbol __imp__NS_CStringSetDataRange referenced in function "public: void __thiscall nsACString::Replace(unsigned int,unsigned int,char const *,unsigned int)" (?Replace@nsACString@@QAEXIIPBDI@Z)
browserplaces_s.lib(nsPlacesImportExportService.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringSetDataRange
migration_s.lib(nsOperaProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringSetDataRange
migration_s.lib(nsIEProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringSetDataRange
xpcomglue_s.lib(nsVoidArray.obj) : error LNK2001: unresolved external symbol __imp__NS_StringContainerFinish
xpcomglue_s.lib(nsINIParser.obj) : error LNK2001: unresolved external symbol __imp__NS_StringContainerFinish
migration_s.lib(nsProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_StringContainerFinish
migration_s.lib(nsNetscapeProfileMigratorBase.obj) : error LNK2001: unresolved external symbol __imp__NS_StringContainerFinish
migration_s.lib(nsBrowserProfileMigratorUtils.obj) : error LNK2001: unresolved external symbol __imp__NS_StringContainerFinish
xpcomglue_s.lib(nsStringAPI.obj) : error LNK2001: unresolved external symbol __imp__NS_StringContainerFinish
migration_s.lib(nsOperaProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_StringContainerFinish
migration_s.lib(nsPhoenixProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_StringContainerFinish
migration_s.lib(nsSeamonkeyProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_StringContainerFinish
migration_s.lib(nsIEProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_StringContainerFinish
browser_feeds_s.lib(nsFeedSniffer.obj) : error LNK2019: unresolved external symbol __imp__NS_StringContainerFinish referenced in function "public: __thiscall nsDependentSubstring_external::~nsDependentSubstring_external(void)" (??1nsDependentSubstring_external@@QAE@XZ)
browserplaces_s.lib(nsPlacesImportExportService.obj) : error LNK2001: unresolved external symbol __imp__NS_StringContainerFinish
shellservice_s.lib(nsWindowsShellService.obj) : error LNK2001: unresolved external symbol __imp__NS_StringContainerFinish
migration_s.lib(nsDogbertProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_StringContainerFinish
migration_s.lib(nsBrowserProfileMigratorUtils.obj) : error LNK2019: unresolved external symbol __imp__NS_CStringContainerInit2 referenced in function "class nsDependentSubstring_external const __cdecl Substring(class nsAString const &,unsigned int)" (?Substring@@YA?BVnsDependentSubstring_external@@ABVnsAString@@I@Z)
xpcomglue_s.lib(nsStringAPI.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringContainerInit2
migration_s.lib(nsSeamonkeyProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringContainerInit2
migration_s.lib(nsIEProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringContainerInit2
migration_s.lib(nsProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringContainerInit2
migration_s.lib(nsNetscapeProfileMigratorBase.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringContainerInit2
shellservice_s.lib(nsWindowsShellService.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringContainerInit2
migration_s.lib(nsDogbertProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringContainerInit2
migration_s.lib(nsOperaProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringContainerInit2
migration_s.lib(nsPhoenixProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringContainerInit2
browser_feeds_s.lib(nsFeedSniffer.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringContainerInit2
browserplaces_s.lib(nsPlacesImportExportService.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringContainerInit2
browserabout_s.lib(AboutRedirector.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringContainerInit2
browserdir_s.lib(DirectoryProvider.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringContainerInit2
xpcomglue_s.lib(nsVoidArray.obj) : error LNK2001: unresolved external symbol __imp__NS_StringContainerInit
xpcomglue_s.lib(nsINIParser.obj) : error LNK2001: unresolved external symbol __imp__NS_StringContainerInit
migration_s.lib(nsProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_StringContainerInit
migration_s.lib(nsNetscapeProfileMigratorBase.obj) : error LNK2001: unresolved external symbol __imp__NS_StringContainerInit
migration_s.lib(nsBrowserProfileMigratorUtils.obj) : error LNK2001: unresolved external symbol __imp__NS_StringContainerInit
xpcomglue_s.lib(nsStringAPI.obj) : error LNK2001: unresolved external symbol __imp__NS_StringContainerInit
migration_s.lib(nsOperaProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_StringContainerInit
migration_s.lib(nsPhoenixProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_StringContainerInit
migration_s.lib(nsSeamonkeyProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_StringContainerInit
migration_s.lib(nsIEProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_StringContainerInit
browser_feeds_s.lib(nsFeedSniffer.obj) : error LNK2019: unresolved external symbol __imp__NS_StringContainerInit referenced in function "public: __thiscall nsString_external::nsString_external(void)" (??0nsString_external@@QAE@XZ)
browserplaces_s.lib(nsPlacesImportExportService.obj) : error LNK2001: unresolved external symbol __imp__NS_StringContainerInit
shellservice_s.lib(nsWindowsShellService.obj) : error LNK2001: unresolved external symbol __imp__NS_StringContainerInit
migration_s.lib(nsDogbertProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_StringContainerInit
xpcomglue_s.lib(nsVoidArray.obj) : error LNK2001: unresolved external symbol __imp__NS_StringCopy
migration_s.lib(nsNetscapeProfileMigratorBase.obj) : error LNK2001: unresolved external symbol __imp__NS_StringCopy
migration_s.lib(nsBrowserProfileMigratorUtils.obj) : error LNK2001: unresolved external symbol __imp__NS_StringCopy
unicharutil_external_s.lib(nsUnicharUtils.obj) : error LNK2001: unresolved external symbol __imp__NS_StringCopy
xpcomglue_s.lib(nsStringAPI.obj) : error LNK2001: unresolved external symbol __imp__NS_StringCopy
browserplaces_s.lib(nsPlacesImportExportService.obj) : error LNK2019: unresolved external symbol __imp__NS_StringCopy referenced in function "public: void __thiscall nsAString::Assign(class nsAString const &)" (?Assign@nsAString@@QAEXABV1@@Z)
shellservice_s.lib(nsWindowsShellService.obj) : error LNK2001: unresolved external symbol __imp__NS_StringCopy
migration_s.lib(nsOperaProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_StringCopy
migration_s.lib(nsIEProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_StringCopy
xpcomglue_s.lib(nsStringAPI.obj) : error LNK2001: unresolved external symbol __imp__NS_StringSetDataRange
browserplaces_s.lib(nsPlacesImportExportService.obj) : error LNK2019: unresolved external symbol __imp__NS_StringSetDataRange referenced in function "public: void __thiscall nsAString::Replace(unsigned int,unsigned int,unsigned short const *,unsigned int)" (?Replace@nsAString@@QAEXIIPBGI@Z)
shellservice_s.lib(nsWindowsShellService.obj) : error LNK2001: unresolved external symbol __imp__NS_StringSetDataRange
migration_s.lib(nsIEProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_StringSetDataRange
migration_s.lib(nsBrowserProfileMigratorUtils.obj) : error LNK2001: unresolved external symbol __imp__NS_StringSetDataRange
migration_s.lib(nsBrowserProfileMigratorUtils.obj) : error LNK2001: unresolved external symbol __imp__NS_Free
xpcomglue_s.lib(nsTArray.obj) : error LNK2001: unresolved external symbol __imp__NS_Free
browserplaces_s.lib(nsPlacesImportExportService.obj) : error LNK2019: unresolved external symbol __imp__NS_Free referenced in function "public: static void __cdecl nsMemory::Free(void *)" (?Free@nsMemory@@SAXPAX@Z)
migration_s.lib(nsOperaProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_Free
migration_s.lib(nsSeamonkeyProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_Free
migration_s.lib(nsIEProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_Free
xpcomglue_s.lib(nsMemory.obj) : error LNK2001: unresolved external symbol __imp__NS_Alloc
browserplaces_s.lib(nsPlacesImportExportService.obj) : error LNK2019: unresolved external symbol __imp__NS_Alloc referenced in function "char * __cdecl nsEscapeHTML(char const *)" (?nsEscapeHTML@@YAPADPBD@Z)
xpcomglue_s.lib(nsGenericFactory.obj) : error LNK2001: unresolved external symbol __imp__NS_Alloc
xpcomglue_s.lib(nsTArray.obj) : error LNK2001: unresolved external symbol __imp__NS_Alloc
xpcomglue_s.lib(nsCRTGlue.obj) : error LNK2001: unresolved external symbol __imp__NS_Alloc
migration_s.lib(nsNetscapeProfileMigratorBase.obj) : error LNK2001: unresolved external symbol __imp__NS_StringContainerInit2
migration_s.lib(nsBrowserProfileMigratorUtils.obj) : error LNK2001: unresolved external symbol __imp__NS_StringContainerInit2
xpcomglue_s.lib(nsStringAPI.obj) : error LNK2001: unresolved external symbol __imp__NS_StringContainerInit2
migration_s.lib(nsPhoenixProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_StringContainerInit2
migration_s.lib(nsSeamonkeyProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_StringContainerInit2
migration_s.lib(nsIEProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_StringContainerInit2
migration_s.lib(nsProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_StringContainerInit2
browserplaces_s.lib(nsPlacesImportExportService.obj) : error LNK2019: unresolved external symbol __imp__NS_StringContainerInit2 referenced in function "protected: __thiscall nsString_external::nsString_external(unsigned short const *,unsigned int,unsigned int)" (??0nsString_external@@IAE@PBGII@Z)
shellservice_s.lib(nsWindowsShellService.obj) : error LNK2001: unresolved external symbol __imp__NS_StringContainerInit2
migration_s.lib(nsDogbertProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_StringContainerInit2
migration_s.lib(nsOperaProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_StringContainerInit2
xpcomglue_s.lib(nsVoidArray.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringCopy
migration_s.lib(nsSeamonkeyProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringCopy
migration_s.lib(nsIEProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringCopy
migration_s.lib(nsBrowserProfileMigratorUtils.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringCopy
xpcomglue_s.lib(nsStringAPI.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringCopy
browserplaces_s.lib(nsPlacesImportExportService.obj) : error LNK2019: unresolved external symbol __imp__NS_CStringCopy referenced in function "public: __thiscall nsCString_external::nsCString_external(class nsCString_external const &)" (??0nsCString_external@@QAE@ABV0@@Z)
browserabout_s.lib(AboutRedirector.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringCopy
shellservice_s.lib(nsWindowsShellService.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringCopy
migration_s.lib(nsOperaProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringCopy
migration_s.lib(nsIEProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_UTF16ToCString
migration_s.lib(nsNetscapeProfileMigratorBase.obj) : error LNK2001: unresolved external symbol __imp__NS_UTF16ToCString
migration_s.lib(nsBrowserProfileMigratorUtils.obj) : error LNK2001: unresolved external symbol __imp__NS_UTF16ToCString
xpcomglue_s.lib(nsStringAPI.obj) : error LNK2001: unresolved external symbol __imp__NS_UTF16ToCString
browserplaces_s.lib(nsPlacesImportExportService.obj) : error LNK2019: unresolved external symbol __imp__NS_UTF16ToCString referenced in function "public: __thiscall NS_ConvertUTF16toUTF8_external::NS_ConvertUTF16toUTF8_external(class nsAString const &)" (??0NS_ConvertUTF16toUTF8_external@@QAE@ABVnsAString@@@Z)
migration_s.lib(nsDogbertProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_UTF16ToCString
migration_s.lib(nsOperaProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_UTF16ToCString
migration_s.lib(nsSeamonkeyProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_UTF16ToCString
browserdir_s.lib(DirectoryProvider.obj) : error LNK2019: unresolved external symbol __imp__NS_NewNativeLocalFile referenced in function "public: virtual unsigned int __stdcall mozilla::browser::DirectoryProvider::GetFile(char const *,int *,class nsIFile * *)" (?GetFile@DirectoryProvider@browser@mozilla@@UAGIPBDPAHPAPAVnsIFile@@@Z)
migration_s.lib(nsOperaProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_NewNativeLocalFile
migration_s.lib(nsBrowserProfileMigratorUtils.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringToUTF16
xpcomglue_s.lib(nsStringAPI.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringToUTF16
migration_s.lib(nsSeamonkeyProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringToUTF16
migration_s.lib(nsIEProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringToUTF16
migration_s.lib(nsProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringToUTF16
migration_s.lib(nsNetscapeProfileMigratorBase.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringToUTF16
shellservice_s.lib(nsWindowsShellService.obj) : error LNK2019: unresolved external symbol __imp__NS_CStringToUTF16 referenced in function "public: __thiscall NS_ConvertUTF8toUTF16_external::NS_ConvertUTF8toUTF16_external(char const *,unsigned int)" (??0NS_ConvertUTF8toUTF16_external@@QAE@PBDI@Z)
migration_s.lib(nsDogbertProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringToUTF16
migration_s.lib(nsOperaProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringToUTF16
migration_s.lib(nsPhoenixProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringToUTF16
migration_s.lib(nsDogbertProfileMigrator.obj) : error LNK2019: unresolved external symbol __imp__NS_StringCloneData referenced in function "unsigned short * __cdecl ToNewUnicode(class nsAString const &)" (?ToNewUnicode@@YAPAGABVnsAString@@@Z)
migration_s.lib(nsOperaProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_StringCloneData
migration_s.lib(nsPhoenixProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_StringCloneData
migration_s.lib(nsSeamonkeyProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_StringCloneData
xpcomglue_s.lib(nsStringAPI.obj) : error LNK2019: unresolved external symbol __imp__NS_CStringCloneData referenced in function "public: void __thiscall nsACString::AppendInt(int,int)" (?AppendInt@nsACString@@QAEXHH@Z)
migration_s.lib(nsOperaProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringCloneData
migration_s.lib(nsSeamonkeyProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringCloneData
migration_s.lib(nsIEProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringCloneData
migration_s.lib(nsNetscapeProfileMigratorBase.obj) : error LNK2001: unresolved external symbol __imp__NS_CStringCloneData
migration_s.lib(nsOperaProfileMigrator.obj) : error LNK2019: unresolved external symbol __imp__NS_Realloc referenced in function "public: static void * __cdecl nsMemory::Realloc(void *,unsigned int)" (?Realloc@nsMemory@@SAPAXPAXI@Z)
xpcomglue_s.lib(nsTArray.obj) : error LNK2001: unresolved external symbol __imp__NS_Realloc
migration_s.lib(nsIEProfileMigrator.obj) : error LNK2019: unresolved external symbol __imp__NS_StringSetData referenced in function "public: void __thiscall nsAString::Assign(unsigned short const *,unsigned int)" (?Assign@nsAString@@QAEXPBGI@Z)
migration_s.lib(nsIEProfileMigrator.obj) : error LNK2019: unresolved external symbol __imp__NS_NewLocalFile referenced in function "protected: int __thiscall nsIEProfileMigrator::TestForIE7(void)" (?TestForIE7@nsIEProfileMigrator@@IAEHXZ)
migration_s.lib(nsProfileMigrator.obj) : error LNK2001: unresolved external symbol __imp__NS_NewLocalFile
migration_s.lib(nsNetscapeProfileMigratorBase.obj) : error LNK2001: unresolved external symbol __imp__NS_NewLocalFile
unicharutil_external_s.lib(nsUnicharUtils.obj) : error LNK2019: unresolved external symbol __imp__NS_StringGetMutableData referenced in function "void __cdecl ToLowerCase(class nsAString const &,class nsAString &)" (?ToLowerCase@@YAXABVnsAString@@AAV1@@Z)
xpcomglue_s.lib(nsStringAPI.obj) : error LNK2001: unresolved external symbol __imp__NS_StringGetMutableData
xpcomglue_s.lib(nsStringAPI.obj) : error LNK2019: unresolved external symbol __imp__NS_CStringGetMutableData referenced in function "public: unsigned int __thiscall nsACString::BeginWriting(char * *,char * *,unsigned int)" (?BeginWriting@nsACString@@QAEIPAPAD0I@Z)
xpcomglue_s.lib(nsComponentManagerUtils.obj) : error LNK2019: unresolved external symbol __imp__NS_GetServiceManager referenced in function "unsigned int __cdecl CallGetService(struct nsID const &,struct nsID const &,void * *)" (?CallGetService@@YAIABUnsID@@0PAPAX@Z)
xpcomglue_s.lib(nsComponentManagerUtils.obj) : error LNK2019: unresolved external symbol __imp__NS_GetComponentManager referenced in function "unsigned int __cdecl CallCreateInstance(struct nsID const &,class nsISupports *,struct nsID const &,void * *)" (?CallCreateInstance@@YAIABUnsID@@PAVnsISupports@@0PAPAX@Z)
xpcomglue_s.lib(nsMemory.obj) : error LNK2019: unresolved external symbol __imp__NS_GetMemoryManager referenced in function "public: static class nsIMemory * __cdecl nsMemory::GetGlobalMemoryService(void)" (?GetGlobalMemoryService@nsMemory@@SAPAVnsIMemory@@XZ)

suggestions?
(Reporter)

Comment 20

8 years ago
Make sure the libraries that go into a binary are compiled with MOZILLA_PRIVATE_API = 1. Also, here are the timeless words:

bsmedberg: correct, browsercomps should link -lxpcomglue_s -lxpcom
bsmedberg: and firefox-bin should link -lxpcom_core but not -lxpcom or -lxpcomglue_s or -lxpcomglue
bsmedberg: in fact, nobody at all should be linking -lxpcomglue, we should stop building it because it's totally useless in this configuration

browsercomps in my case is a dynamic library, just like xpcom.

Does it work for you when you use the settings that I'm using in my patch?

Comment 21

8 years ago
Just an FYI, Ted asked me to post - the original test I ran involved cross imports between a dll and an exe. I just confirmed the same can be done with two exes, the main app can load another exe as if it were a library and use it's exports.
Status: NEW → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.