The C API library for Windows is built using Microsoft Visual Studio 2019 (v142). It includes only 64-bit binaries. Building and releasing an application using the SketchUp C API for Windows requires including SketchUpAPI.dll and SketchUpCommonPreferences.dll, which can be found in the SketchUp C SDK for Windows. Also, the following C runtime DLLs must be included: msvcp140.dll and msvcr140.dll. Due to Microsoft binary compatability, the runtime DLLs remain named “-v140.dll”
… and further down …
Using a different Platform Toolset will likely cause the plugin to fail to load and cause SketchUp to crash.
So, no (before opening a new issue) … I’d first suggest setting getting a newer VS version and trying again, or try your import plugin in SketchUp 2019.
Besides … I already opened several documentation issues for those old docs in the C SDK. ie …
I would guess that you are compiling in “Debug” mode (opposed to “Release” mode). The
“Debug”-compiled code WILL crash Sketchup the moment you select the Import command.
Compile as “Release” and you will be good.
This has been discussed previously on the forum (although some years ago).
The only times I have seen this particular behavior - crashing when selecting the Import command, has been caused by incorrectly applying “Debug” mode.
However, I guess there could be other causes out there…
For mywself, I have used SDK_WIN_x64_2019-3-253 and SDK_WIN_x64_2020-0-363 without issues, I am not sure if there are newer versions available…
looking at the call stack after the crash suggests that it is related to when SketchUp is displaying the file selection dialog. If I just force it to continue when an exception occurs it eventually shows the dialog and I can select and import the xml file.
Just to chime in - I have the very same problem with the same exact call stack when it crashes. I am compiling with Platform Toolset Visual Studio 2019 (v142) and Windows Platform SDK 8.1 (Also tried with Platform SDK 10.0 but ended up in the same place). I haven’t tried SketchUp 2019 though…has anyone else come across the same issue and resolved it? it sounds like a bug in the sample code not being compatible with 2020 IMO…
FWIW, just as a check I took one of my own importers and recompiled it using the very latest Visual Studio 2019 (v142). I use Windows SDK version 10.0.
Interestingly, after applying the very latest Visual Studio 2019 upgrades, my code did not directly compile anymore, so I had to add some #includes which were not necessary before…
Anyway, after dropping the recompiled dll into the Importers directory, the importer still operated as expected.
In this particular case I am still using the SDK_WIN_x64_2019-3-253 (I have not upgraded that solution to use SDK_WIN_x64_2020-0-363 yet, I guess it will work, but I do not know with certainty).
I am working within Windows 10 Version 1903.
I am still using the Sketchup version 20.0.373 as the later versions gave me serious problems. These Sketchup problems have been discussed on the forum, they might have been fixed by now, but I have not taken the time to check this.
I have not taken the (latest?) xml_to_skp code, so I do not know how this behave. It is summer vacation now so I am just occasionally within reach of my computer…
Updated:
I updated to Sketchup 20.1.235 on another machine (I will not change from 20.0.373 on my main machine without some serious testing).
Dropping my own recently recompiled importer to this machine works nicely as well.
Updated again:
Recompiling and linking my own importer with SDK_WIN_x64_2020-0-363 appears to give no problems as well.
Oddity: On Sketchup’s SDK page (SketchUp Developer SDK | SketchUp Extension Warehouse) they refer to the latest Windows SDK version as 20.0.362. Well, the minor version I have is 363 (not 362).
Maybe just a typing error on the SDK page?
Ok - some progress on my end trying to make this work…
I am using Windows 10 - build 1803. VS 2019, Windows SDK Platform 8.1, Platform Toolset VS 2019 (v142), SketchUp 2020.1.235.
I didn’t need to change the include path to resolve the include files.
I can compile successfully. When I run SketchUp on its own and select “import…” it crashes.
When I run SketchUp with the VS Debugger or even attaching to the debugger to the SketchUp process, I can select “Import…”, and the Debugger traps the exception with the call stack listed above. I can then hit F5 and continue - which hits another exception for which I can also continue and with F5 to then get the File Dialog to pop up and successfully load a .xml previously generated by the other skp_2_xml sample. I hope this helps some as clearly, attaching the debugger allows to get forward but either a race condition or something else is at play here…
Note: I also tried with Windows Platform SDK 10 and the same behavior can be observed (as a mean to rule out any dependency on 10 vs 8.1)
worth noting that a Debug build and associated Debugger session fails to publish the .xml as a valid file to import. I haven’t pinpointed where the plugin fails though
EDIT, yes a typo. These versions are the application release version/build numbers.
Ie, they are incorrectly swapped, .363 was the Windows build, .362 was the MacOS build.
The C SDK (API) has it’s own version release numbers.
(It is listed in the “version.txt” file in the root of the SDK package.)
The latest public C API release is … 2020 April 23: API Version 8.1 - SketchUp 2020.1
I am using the SketchUp SDK 229.
i don’t understand why anyone would ship an SDK Sample that can’t be debugged in Debug - this raises a lot of question about the quality of the sample IMO.