Static link MFC causes String Table collision?

My app links with MFC as a DLL just fine.  When I link it with "MFC statically linked" then I get some errors which seem to have to do with the attempt to redefine strings.  I have
a pretty big string table, and the entries in the string table whoose IDs
are above 61440 (which is 0xF000) start
colliding with stuff in MFC/INCLUDE/afxres.rc (for example AFX_IDS_OPENFILE seems to want to use
ID 61440). If I remove the entries in my
string table that are at 61440 and higher, then it builds OK.

Can someone explain what is going on and
how I can get around this?  I'd like to
have stuff in my string table above 61440, and as my app is not yet complete, I may wish to add even more stuff in the string table...

tullheadAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
luisrConnect With a Mentor Commented:
The problem is that MFC uses strings above 61440. When you link with the DLL version of MFC, those strings are in the DLL itself, so you can use those IDs for your own app inside your executable file.

When you link MFC statically, those same strings must go somewhere, and they go inside your own EXE, that is why you cannot add strings above that ID, or your app will function improperly.

The fix: renumber your strings or don't link with MFC statically.
0
 
tullheadAuthor Commented:
Looking at my String Table (and I'm not
sure how it got this way) there are large gaps in the ID numbers used, for
example one entry uses 1002, and the
next uses 32771.  Also, one uses 32792
and the next one uses 57344.

So perhaps I'll move some of my strings
into those "gaps".

But before I do, are there other restrictions or other "collisions" with
MFC awaiting me?  Am I free to use any
of these IDs below 61440?

Also, is there some way to tell MFC to
start its ID use at a number higher
than 61440?

Thanks...
0
 
luisrCommented:
There is no easy way to modify MFC's strings... You would have to edit internal header files and source code and recompile it.
0
 
ZoppoCommented:
Hi tullhead:

>are there other restrictions or other "collisions" with MFC awaiting me?
see MSDN article 'TN020: ID Naming and Numbering Conventions' ...

ZOPPO
0
 
tullheadAuthor Commented:
Thanks!
0
All Courses

From novice to tech pro — start learning today.