summaryrefslogtreecommitdiff
path: root/src/utilcode
diff options
context:
space:
mode:
authorJan Vorlicek <janvorli@microsoft.com>2015-03-19 21:06:20 +0100
committerJan Vorlicek <janvorli@microsoft.com>2015-03-24 10:16:21 +0100
commit76487bfc8ab78b35c120fc1dd590ae892e4af5f6 (patch)
tree2e49dccd36b0031c335dd859b461488392d80826 /src/utilcode
parenteb74cfe415fae5458adda1083b842011cee17728 (diff)
downloadcoreclr-76487bfc8ab78b35c120fc1dd590ae892e4af5f6.tar.gz
coreclr-76487bfc8ab78b35c120fc1dd590ae892e4af5f6.tar.bz2
coreclr-76487bfc8ab78b35c120fc1dd590ae892e4af5f6.zip
Add native resources compilation on Linux
This change adds compilation of native resources into a gettext binary format and loading of string resources in coreclr on Linux. On OSX, the resource string still contains just a formatted resource id.
Diffstat (limited to 'src/utilcode')
-rw-r--r--src/utilcode/ccomprc.cpp27
1 files changed, 25 insertions, 2 deletions
diff --git a/src/utilcode/ccomprc.cpp b/src/utilcode/ccomprc.cpp
index 56c53e2e5c..d69fe0c77d 100644
--- a/src/utilcode/ccomprc.cpp
+++ b/src/utilcode/ccomprc.cpp
@@ -262,6 +262,11 @@ LPCWSTR CCompRC::m_pDefaultResource = W("mscorrc.debug.dll");
LPCWSTR CCompRC::m_pFallbackResource= W("mscorrc.dll");
#endif // !FEATURE_CORECLR
+#ifdef FEATURE_PAL
+LPCSTR CCompRC::m_pDefaultResourceDomain = "mscorrc.debug";
+LPCSTR CCompRC::m_pFallbackResourceDomain = "mscorrc";
+#endif // FEATURE_PAL
+
HRESULT CCompRC::Init(LPCWSTR pResourceFile, BOOL bUseFallback)
{
CONTRACTL
@@ -308,6 +313,25 @@ HRESULT CCompRC::Init(LPCWSTR pResourceFile, BOOL bUseFallback)
return E_OUTOFMEMORY;
}
+#ifdef FEATURE_PAL
+
+ if (m_pResourceFile == m_pDefaultResource)
+ {
+ m_pResourceDomain = m_pDefaultResourceDomain;
+ }
+ else if (m_pResourceFile == m_pFallbackResource)
+ {
+ m_pResourceDomain = m_pFallbackResourceDomain;
+ }
+ else
+ {
+ _ASSERTE(!"Unsupported resource file");
+ }
+
+ PAL_BindResources(m_pResourceDomain);
+
+#endif // FEATURE_PAL
+
if (m_csMap == NULL)
{
// NOTE: there are times when the debugger's helper thread is asked to do a favor for another thread in the
@@ -828,11 +852,10 @@ HRESULT CCompRC::LoadString(ResourceCategory eCategory, LocaleID langId, UINT iR
return hr;
#else // !FEATURE_PAL
- // UNIXTODO: Implement real string loading from resources
int len = 0;
if (szBuffer && iMax)
{
- len = _snwprintf(szBuffer, iMax, W("Resource string category=%d, id=0x%x"), eCategory, iResourceID);
+ len = PAL_GetResourceString(m_pResourceDomain, iResourceID, szBuffer, iMax);
}
if (pcwchUsed)