• Login
sketchucation logo sketchucation
  • Login
🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

Skp2xml Sample 2013 SDK crash VS 2012?

Scheduled Pinned Locked Moved Developers' Forum
9 Posts 4 Posters 2.3k Views 4 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    RSullivan
    last edited by 21 Aug 2013, 23:03

    Hello.
    I have Sketchup 2013.
    I have the Sketchup 2013 C++ SDK.

    I have VS 2008 On a Windows 7 Machine and VS 2012 On A Windows 8 machine
    (No VS 2010).

    I was under the impression that I could build the skp2xml.dll sample and
    drop it into the 'Exporter' directory. I then thought that Sketchup would
    then list 'XML Exporter (*.xml)' on the File->Export menu.

    I have build the skp2xml.dll in both debug and release (Win32) modes.
    Windows 8: Sketchup crashes when I click on the 'File' menu (With an object).

    Windows 7: Sketchup does not crash but does not display the expected
    'XML Exporter (*.xml)' on the File->Export menu.

    I believe that the sample is for VS 2010. I cannot open it with VS 2008.
    VS 2012 'Converted' it for me. What am I missing? Compiler/Linker options?

    Thanks for any help.

    1 Reply Last reply Reply Quote 0
    • B Offline
      bugra
      last edited by 22 Aug 2013, 13:59

      Hi,
      The XML Exporter sample builds an exporter plugin for SketchUp and runs in the same process. Due to its C++ interface, it has to be built with the same Visual Studio version as SketchUp, which is VS2010. If you let VS2012 upgrade the project, the resulting DLL will not be compatible and it will likely cause crashes.
      Thanks,
      Bugra

      1 Reply Last reply Reply Quote 0
      • R Offline
        RSullivan
        last edited by 23 Aug 2013, 04:42

        Thanks Bugra.

        Not to start an argument, I am just curious.
        I am a native C++ Win32,Com,WinRt programmer.
        My forte is defiantly not frameworks (Mfc, Stl, Parallel Process Library,...).
        Needless to say I am not a Ruby programmer.

        I have some down time right now so I thought I would plunk around
        with the Sketchup Sdk (This is not for a client, It is personal).

        With that said why exactly is it that I need to compile the skp2xml
        sample with 2010? What could possibly be different with the 'C++ Interface'
        ( I am assuming you are referencing the SketchUpModelExporterInterface struct)?

        Is it packing?
        Is it the calling convention on the SketchUpModelExporterInterface member functions?

        Thanks.

        1 Reply Last reply Reply Quote 0
        • B Offline
          bugra
          last edited by 23 Aug 2013, 18:37

          Hi Robert,
          The problem is heap allocations. More specifically the std::string parameters being passed back and forth. They can't be allocated in one heap and deallocated in another. Binaries built with 2010 and 2012 will operate on different heap managers. To make this work, we would need to expose a C interface (as we did with the new API). But that causes very verbose code, especially when dealing with strings. Since plugins have to run in the SU process anyway, it was implemented with a more convenient C++ interface. The downside is you have to use the same compiler.
          Maybe when C++ gains modules support, we can implement a better solution. but as it stands, the standard makes no guarantees of ABI compatibility between binaries, unfortunately.
          Regards,
          Bugra

          1 Reply Last reply Reply Quote 0
          • R Offline
            RSullivan
            last edited by 26 Aug 2013, 16:24

            Thanks Bugra.

            Ohh, The CRT.

            You said
            "To make this work, we would need to expose a C interface
            (as we did with the new API). But that causes very verbose code,
            especially when dealing with strings."

            Ok, I assume I can write my exporter using the 'C' portion
            of the Sdk.

            To be clear then (If you could kindly verify):

            1.) I cannot write a 'C' exporter that will appear within Sketchup
            as a plugin (i.e appear within the Sketchup Export menu). I will need to write
            it as a stand alone application and have the user manually select the Sketchup file
            for export.
            2.) The Sdk has a director: C:\Source\Sketchup2013\Sdk\SketchUp-SDK-Win\binaries\x64
            which contains a slaip.dll and .lib. I assume these are valid for x64?
            3.) I am not able to write any sort of Sketchup 'plugin' with the C Sdk (Like
            the ones available via the Sketchup Extension Warehouse. These are all Ruby based).

            Thanks again for your time.

            1 Reply Last reply Reply Quote 0
            • B Offline
              bugra
              last edited by 26 Aug 2013, 19:19

              @rsullivan said:

              1.) I cannot write a 'C' exporter that will appear within Sketchup
              as a plugin (i.e appear within the Sketchup Export menu). I will need to write
              it as a stand alone application and have the user manually select the Sketchup file
              for export.

              Correct. Plugins have to go through a C++ interface but they use the C API to implement the actual import/export. They'll need to use the same CRT since they'll communicate with SketchUp via the C++ interface. For a standalone application, you can use any VS version you'd like. Our slapi.dll will still need Visual C++ 2010 redistributable package installed in order to run. But you can write your code in any other VS version (or even any programming language that can talk to a C API, which is almost any language).

              @rsullivan said:

              2.) The Sdk has a director: C:\Source\Sketchup2013\Sdk\SketchUp-SDK-Win\binaries\x64
              which contains a slaip.dll and .lib. I assume these are valid for x64?

              Yes, they are the 64-bit binaries.

              @rsullivan said:

              3.) I am not able to write any sort of Sketchup 'plugin' with the C Sdk (Like
              the ones available via the Sketchup Extension Warehouse. These are all Ruby based).

              Yes, the SDK can currently only read/write .skp files and it is not a replacement for the Ruby API.

              1 Reply Last reply Reply Quote 0
              • R Offline
                RSullivan
                last edited by 27 Aug 2013, 18:38

                Thanks Bugra.
                The information you have provided has been most helpful.

                Thanks again.

                1 Reply Last reply Reply Quote 0
                • I Offline
                  IngMaroPari
                  last edited by 7 Sept 2016, 12:42

                  What if I want to build a custom exporter, just like skp2xml but to export to my own custom format? There is out there any sort of tutorial? I have to use the SDK or (since I have a C dll library that is already able to create my structure, only needs the input model) I can use the Ruby API with

                  require; "custom.dll"
                  

                  or something like that? Sorry if this reply is OT but I found no other way to contact Bugra.

                  1 Reply Last reply Reply Quote 0
                  • Dan RathbunD Offline
                    Dan Rathbun
                    last edited by 7 Sept 2016, 16:55

                    If the DLL does not have Ruby interfaces, then you will need to load and use it via the Ruby Fiddle library.

                    Index of Classes & Methods in fiddle: Ruby Standard Library Documentation (Ruby 2.0.0)

                    favicon

                    (ruby-doc.org)

                    Link Preview Image
                    Module: Fiddle (Ruby 2.0.0)

                    Module : Fiddle - Ruby 2.0.0

                    favicon

                    (ruby-doc.org)

                    I'm not here much anymore.

                    1 Reply Last reply Reply Quote 0
                    • 1 / 1
                    • First post
                      Last post
                    Buy SketchPlus
                    Buy SUbD
                    Buy WrapR
                    Buy eBook
                    Buy Modelur
                    Buy Vertex Tools
                    Buy SketchCuisine
                    Buy FormFonts

                    Advertisement