Sharing Resource Files Between C# and C++, Possible?

D

Dave L

I have a Managed C++ DLL used by a C# application. I'm building with VS .NET
2002.

I have a resx file loaded with string data. The C# application can access
the string data fine, like so:

ResourceManager rm = new ResourceManager("DS.Names",
Assembly.GetExecutingAssembly());
String text = rm.GetString("1");

Now in my Managed C++ DLL I want to do the same thing:

ResourceManager* rm = new ResourceManager("DS.Names",
Assembly::GetExecutingAssembly());
System::String* text = rm->GetString("1");

However, while it compiles fine if fails with this error on the GetString
line:

'System.Resources.MissingManifestResourceException' occurred in
mscorlib.dll.

Clearly the C++ DLL cannot locate the resource.

Is it possible to share this resx file between C# and C++? If so, how?

Thanks.
 
D

Dave L

Ok, I think I've determined that resx files are not supported on .NET 2002
and C++.

Maybe .NET 2003 and Framework 1.1 supports this.

Can anyone confirm this?

Thanks.
 
D

Dave L

I found a work around.

Use the Resource File Generator (resgen.exe) and convert from a resx to a
resources file. Then ResourceReader can be used by C++ to read the data as
opposed to ResXResourceReader.

This can be automated in the build process.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top