views:

440

answers:

1

I'm writing a mixed C++/CLI DLL with both managed and unmanaged classes. Both need access to string and other types of resources, like Direct3D textures.

How best to embed them within the DLL? It seems like there are several ways to do this; .resx (new style, managed), .rc (old style) which can be used to generate .resources files and (optionally) embedded within the assembly.

Currently I'm using a .rc file and ::LoadString() to get my strings. I have a managed wrapper for this to return String^ values to managed code. And a similar method to return WCHAR* to native code.

Is there a better way of doing this? What are the tradeoffs? I could for instance use a .resx file and the ResourceManager class for managed code and an .rc for native but this means I can't share resources etc. Is there a recommended approach?

Thanks,

Ade

+1  A: 

I just use a .resx and if there is any strings the native code needs I use managed to get stuff out of my .resx file and convert it into a CString on the next line.

Although you already have a wrapper to do this so it would be even easier.

.rc files are so 1997 man!

demoncodemonkey
`rc` files are for using in native applications. they are ok. Transistors are from 1947 but they still ok.
Kirill V. Lyadvinsky
I agree. However if I had a choice between using 1947 transistors, 2009 transistors, or both (doubling the size of my device), I would use the 2009 ones.
demoncodemonkey