Dll Importers using VS 2015 Express


I just wanted to understand correctly - I can not compile a dll importer using Visual Studio Express 2015 because SketchUp (the .exe) requires the dll importer be linked against the 2010 visual studio c++ runtime libraries?


Jim, please take a look at this post and this one. Your understanding is correct, a dll importer/exporter must run on the same C++ runtime as SketchUp. However, it sounds like you had compilation problems? I would expect the DLL to build just fine but crash in runtime.


I misused the word “compile.” I was able to create the dll using VS2015 but it did indeed crash SketchUp quickly.

From what I understand, it’s just not possible to use VS2015 to create a dll linked against the version 100 run time libraries, and I would need to purchase a license for Visual Studio 2010.

What I want to attempt is to re-write the pure-Ruby .stl importer using c or c++ to make it faster. I want to use the Open Asset Import Library to handle converting the file to a mesh. Assimp has the added bonus of numerous file formats which could also be supported for SketchUp. I am under the impression creating a dll importer is the best or recommended way to develop this importer?

I was able to create a command-line converter using assimp which converts a supported 3d model file to a .skp file. The converter works well and is fast, as I had hoped. My next step was going to be to create the dll importer based on the command line code. But unfortunately, this does seem possible with the tools I have available.

The dependence on a specific (an old) version of Visual Studio seems like a very limiting barrier to developing extensions. It is for me, anyway.

Am I correct and if so are there any alternative ways to write this importer?


The problem here is that the importer/exporter API exposes C++ objects (like std::string). Since C++ doesn’t yet have a standard binary interface, different compilers will not necessarily be interoperable. When we upgrade SketchUp to VS2015, for instance, there will still be developers who wish to use VS2013, etc. So, one robust way to solve this would be to change the API to a C API. And that brings obvious back-compatibility issues.

Long story short, you do need VS2010 if you’d like to write an importer/exporter DLL. The only other option is to write a command-line executable and call it from a Ruby extension.


Thanks for the reply, @bugra. I am starting to understand. So not only are there binary incompatibilities between libraries built using different tools, but also incompatibilities even between different versions of the same tools. I found this article helpful. http://www.mingw.org/wiki/Interoperability_of_Libraries_Created_by_Different_Compiler_Brands

Can you tell me if a dll importer adds geometry to the open model directly, or does it create a temporary skp file and then imports?


Sure Jim, my pleasure. That link explains things very well.

Both importers and exporters deal with temporary skp files, not the live model. SketchUp gives an importer/exporter a path to a temp skp file to write to or read from.


@jim_foltz: Various StackOverflow answers refer to “set the Platform Toolset in project settings within Visual Studio” when the project is to be compiled for an older runtime version. (But I would suppose that the older SDK versions would need to be installed on your system, so VS would be able to add them to the selection listing.)

Microsoft info:
VS Forums: Possible to compile for older runtimes?
MSBuild Multitargeting‎
Breaking Changes in Visual C++‎

Searching MSDN for “VS compile against older runtime”


Correct, I would still need Visual Studio 2010 (not Express edition.) As far as I can tell, this setting just allows a more recent version of VS to use the tools from an older and installed version.


The clang++ compiler from the LLVM project aims for binary compatibility

Clang attempts to be ABI-compatible meaning that Clang-compiled code
should be able to link against MSVC-compiled code successfully. - source

Although I don’t know enough about it to know if clang would work for me for create a dll importer.