using a private build of MFC

Anyone know how to build and link to a private build of MFC?  I found some info in TN033 on MSDN about how to build the dll, but can find nothing on how to use it once it is built. I have tried to use the generated lib file to link, but I either get hundreds of errors because of redefinition of funcions if I just include my lib (this is because nafxcw.lib has the functions declared and is automatically included) , or several unresolved externals if I force nafxcw.lib to be excluded. I cannot find any documentation on how to properly use a private MFC to build a dll.  My goal is to build a private mfc that I can link to so that rebooting will be less likely when my app is installed.

Thanks in advance.
ellingsAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

chensuCommented:
>My goal is to build a private mfc that I can link to so that rebooting will be less likely when my app is installed.

What is this goal? Why don't use static linking if you want to avoid installing additional DLLs?
0
mikeblasCommented:
Before you include AFX.H, you have to define _AFX_NOFORCE_LIBS. Otherwise, MFC will reference its normal libraries.

..B ekiM
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ellingsAuthor Commented:
I can't use static linking because I also have an extension dll that I am linking to, and I don't want to add this code to all of my other dlls. I still see the same behavior when I define _AFX_NOFORCE_LIBS.
0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

mikeblasCommented:
> I still see the same behavior when I define _AFX_NOFORCE_LIBS

Then there's something else wrong with one of your other build settings, and you need to figure it out.

..B ekiM
0
ellingsAuthor Commented:
After rechecking all of my settings and using _AFX_NOFORCE_LIBS, I do notice defferent behavior.  Unfortunatley, I still have two unresolved externals, AFX_MSGMAP and _afxPchNil.  Does anyone know what lib file I need to include for these functions?

Thanks...
0
mikeblasCommented:
_afxPchNil is defined in MFC\SRC\STRCORE.CPP. It should be in your rebuilt library.

AFX_MSGMAP is not a symbol; it's a struct tag. If you've got this symbol in an unresolved externals error, there's something badly wrong with your build!

..B ekiM
0
ellingsAuthor Commented:
I am still havig problems.  I built MFC just like described in TN033.  Any idea what I am doing wrong?  Any help would be greatly appreciated.
0
ellingsAuthor Commented:
I changed the preprocessor defines and the only unresolved external that is reported is AFX_MODULE_STATE.  Once again, does anyone know what lib this is in or what flag needs to be added to the defines?

Thanks
0
ellingsAuthor Commented:
I have found that the problem is mfcs42.lib.  If I include this library, I can build my dll fine, but then it is still linked to the original mfc not my rebuilt mfc.  Is it possible to rebuild mfcs42.lib as well?
0
mikeblasCommented:
Again, AFX_MODULE_STATE is not an external symbol--it's the name of a datatype. If you are seeing this as an unresolved external, you've got some _very_ serious problems with your build. (Or, maybe you're just really bad at accurately quoting error messages.)

MFC42S.LIB builds as byproduct of the MFC DLL build process. Unfortunately, the makefiles shipped in MFC\SRC don't base the name of that static lib on the name you've provided with the LIBNAME= macro.

So, you'll always get MFCS42[u][d].LIB even if LIBNAME= implies something else.

..B ekiM
0
mikeblasCommented:
Where does this stand?  It's been more than a month, now...

..B ekiM
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.