Bug #148
The 3dsmax plugins do not work properly when compiled with static crt
Status: | Closed | Start date: | 10/05/2008 | |
---|---|---|---|---|
Priority: | Low | Due date: | ||
Assignee: | - | % Done: | 0% |
|
Category: | NeL: General | |||
Target version: | Version 0.7.0 |
Description
The 3dsmax plugins do not work properly when compiled with static crt. Sharing crt data between different modules compiled with static crt leads to undefined behaviour and heap corruption. The 3dsmax plugins are each seperate modules, and share data. The object viewer is also a dll by itself (as you cannot use .rc files from a static lib), and random calls going between the export tool and the object viewer (each with their own static crt) crash 3dsmax.
In order for the plugins to be compiled and work correctly, the whole of nel needs to be compiled with crt dll as well (obviously).
History
#1 Updated by kervala almost 10 years ago
Instead of compiling all with dynamic CRT, could you try to compile all with static CRT ?
I noticed you removed all NL_STATIC parts , but new Release and Debug configurations are static by default now, so you should keep static parts and remove dynamic ones.
#2 Updated by kervala almost 10 years ago
For the .rc problem, object_viewer is adding MFC dependencies to 3dsmax plugin, do you think it is worth linking them together ? if I remember, it's just a shortcut to launch it.
.rc can't be linked in a .lib but they can be linked in a .exe :p
#3 Updated by kaetemi almost 10 years ago
I didn't remove anything. The only thing I removed was an ugly hack to link the object_viewer statically to the object_viewer_exe, which I added about a year ago, but this DOES NOT WORK with 3dsmax plugins; because MFC things have a DllMain provided by MFC, and the max plugins provide their own DllMain entry point. It is not possible to link object_viewer statically to nel_export.
Additionally, all plugins are basically a dll on itself, and they share data, which is a scenario which should not and cannot be done with static crt. Compiling with dynamic crt works just fine. Pushing all plugins into one file is NOT a good idea either, btw.
In any case, I don't see a need for static CRT in non-FINAL_VERSION builds. You'll need a seperate config to compile with FINAL_VERSION flag anyway, so you could just as well do static crt only in FINAL_VERSION, since the only scenario where it makes sense, is when sending your app to end users.
#4 Updated by kaetemi almost 10 years ago
There's also the nel_3dsmax_shared dll, which must be a dll in any case, because it is used to share an instance of a class between two plugins. If you link that statically, it won't work at all.
#5 Updated by kervala almost 10 years ago
Ok, so what could we do with NeL configurations ?
Add new dynamic configurations ?
I'm waiting to get a confirmation from NeL leads before to do something :)
#6 Updated by kaetemi almost 10 years ago
- Category set to Tools
- Priority changed from Urgent to Low
#7 Updated by sfb over 9 years ago
- Status changed from New to Closed
We no longer link to static crt so this issue is no longer necessary.
#8 Updated by kervala almost 8 years ago
- Project changed from NeL to Ryzom
- Category deleted (
Tools)
#9 Updated by kervala almost 8 years ago
- Category set to NeL: General
- Target version set to Version 0.7.0