Link to home
Start Free TrialLog in
Avatar of eric3333
eric3333

asked on

Linking a static library with resources.

Hi

I have a problem i cannot solve and perhaps you may help.
But first i explain what i did.

I create a static MFC library.
The library includes some classes and ressources.
I change the resources ID to be sure to not use the same IDS as in the MFC exe i will link the library.
I build the library and all is ok.

Now i open my MFC exe project to link the library in.
I add the library ressources header file and the library rc file in my own rc file.
I add the library itself to my project.
I compile and all is ok.

Now the problem occurs at runtime.
I launch my application and the program make very strange exception for example in new operator (very standard new) or other type of code that works perfectly without adding the library.

Does somebody know what i did wrong ?

THanks


ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of eric3333
eric3333

ASKER

HI everybody.

I found the problem. I am just an idiot.
Both the library and the exe uses MFC.
And i link a release version of the library with a debug version of the exe. And all the problems come from this.
Now all works fine.

One point for itsmeandnobodyelse.
When you add a RC in a library the RC is not linked to the library because a library cannot integrate resources.
Only DLL can be linked with rc.

I share the points to everybody. Thanks again.
>>> because a library cannot integrate resources.

Thank for the info. I didn't know what happens if you add an rc file to static library project.

Regards, Alex
Yes
In fact when you add a rc to a library you can use studio but only for this.
The rc is not linked.
Best regards