Is there anyway to load a debug version of a export dll. If I take the example skp_to_xml debug dll and load it in sketchup sketchup crashes. Only the release seems to work. I know that I can turn off all optimizations for the release version and that works. But is there a way to load the debug version?
Not sure what platform you are using. here but…
On Windows, using Visual Studio I would think you can install your debug build exporter, start SketchUp and then attach Visual Studio to the SU process.
@bugra - got some insight to this one?
Yes that is what I am doing, it works fine. But the optimization is in release so most of the information is missing. Again, I can disable all optimization in release, but that is exactly what debug is for.
You see these crashes due to the std::string objects in the import/export API. These get copied between SketchUp and the exporter plugin. So they have to be on the same heap manager. Debug and Release versions of the C++ runtime have different heaps and they won’t allow allocating memory on one and releasing it on the other. Also, the sizes of the string objects may not agree between debug and release.
I think the only way to do this is to write a shim DLL that’s built for Release and forwards the API calls to your DLL through a C API where the strings are plain C style strings. I realize that would be a big nuisance to maintain though, so I would just turn off optimizations in Release and “debug” that way.
Sorry about the inconvenience but this is partly due to C++ not having a standardized binary interface yet. But in retrospect, our API could have been cleaner and could have avoided these issues.
Dll Importers using VS 2015 Express
Alright, thanks for the info. Interesting about the std::strings I was not aware of that.