Plugin DLL
-
A few more links:
ruby embedded into c++
Tutorial, Guide, Howto
by Simon neoneye Strandgaardstackoverflow forum topic:
How to embed Ruby in C++?
... which mentions a textfile that comes with the Ruby source, named: README.EXT -
Other threads on this issue:
Getting Started with C++ and Sketchup
Ruby extension module using C/C++ (mostly about using SWIG)
Example of Compiled Extension with SWIG and CMake
Ruby C++ extension crashes SketchUp
Re: Optimization Tips (discussing Ruby vs C speed)
Programming in C, C++ for Mac and Windows?
Are Swig generated Ruby bindings compatible with Sketchup?
Examples:
-
Added an [Info] page to the [Code Snippets] sticky thread, specifically for C/C++ coding links, etc.
-
Thanks to both of you, Al and Dan.
But I'm not sure which way to go anymore! I was under the impression that compiled code would run faster than ruby interpreter!!! As of ruby 1.8, the code is interpreted, not compiled into pcode or anything. So that confuses me even more.
So if 1.9 will not load a dll with require(), then there is no more point on writing a dll is there? The reason I wanted to do this in the first place is for speed, and the fact that I can created windows which you can't do in ruby unless you use html, but again, html is limited, and need extra files, javascript etc.
So what do you guys suggest? Which way is best for now and the future? I mean, they way to go about writing plugins? Simply using ruby and that's it? No more COM or anything?
-
@al hart said:
@unknownuser said:
You can download a copy from:
http://www.renderplus.com/downloads/SimpleExtension.zip
This is basically a Ruby Extension - and SketchUp has created a sample.
What would be good would be a case study where a new user tries to use it, and points out what it is difficult, gets help, etc.
Item (1): coders need to download Ruby source (links here)
Item (2): in the package, file stdafx.h, line 54:
#include "C:/ruby/source/ruby-1.8.2/ruby.h"
needs to be changed to the correct Ruby version source dir, for the plugin's targeted Sketchup version (ruby-1.8.0 for SU < 8, ruby-1.8.6-p287 for SU 8+)Item (3): WIN Sketchup is a MFC application. The package assumes the user will have a full edition of MS Visual Studio, which comes with the MFC source files.
Visual Studio Express editions do not come with these files.Express users can manually add the MFC header files, by installing the Windows Driver Kit Version 7.1.0 The download is an ISO DVD image, but some archive apps can open this type of file, such as 7zip, so you need not waste a blank DVD.
If you manually copy the header files from the ISO arhive, it looks as though the header files may need to be copied & renamed, ie: "_afxwin.h_00593" to "afxwin.h"
Then these files either:- moved to the Windows SDK/includedir, or the appropriate Visual Studio include dir, or 1. set VS-Express to use your WDK/include dir, via the Tools (menu) > Options (dialog)
If you install the WDK then you will not need to rename files, and the Installer may ask if you wish to integrate with Visual Studio, so the include paths may be added for you.
-
I am still confused as to why we need ruby extension. Can't we just get the ISkpApplication COM interface and access Sketchup directly?
-
Well.. you never said specifically what you wished to do... so we are trying to cover all the bases.
If you will not call any standard Ruby functions, nor call any Sketchup Ruby API functions, nor access any Ruby object(s), nor expose any of your C/C++ objects to Ruby.. then
don't have the #include ".../ruby.h" line in your code.You won't know what your limitations are until you start playing.
Obviously... you'll need to #include whatever header files you require from the SDK source dirs.
-
I'm even more mixed up now
OK, if you import the Skectup.exe Type Library, you get the following...
LIBID_SketchUp: TGUID = '{4BFA2F61-04D4-11D4-92DE-0050DA73EEF2}';
IID_ISkpPoint3d: TGUID = '{797A86D9-8EC2-4064-BE94-D4F589FC1A53}';
IID_ISkpVector3d: TGUID = '{1D2F07F1-6BC9-44E8-A228-489E0C6393A0}';
IID_ISkpApplication: TGUID = '{06E0C968-19B6-4973-98CF-E056E6D157AA}';
IID_ISkpDocument: TGUID = '{E6E72823-A815-4760-91A1-76CED4F4AA60}';
IID_ISkpBoundingBox3d: TGUID = '{20131A69-C286-4B2E-9309-E8F6014DF323}';
IID_ISkpFonts: TGUID = '{DF614131-E9F3-42B9-93A2-391058AC0FC1}';
IID_ISkpFont: TGUID = '{69AD8EA1-31BB-4070-B61D-A1313DDCB5BA}';
IID_ISkpView: TGUID = '{2EF46735-233B-45A7-983A-361649055B98}';
IID_ISkpMaterials: TGUID = '{57241BDB-31FA-4831-A00B-7B56733F07F8}';
IID_ISkpMaterial: TGUID = '{E405969E-3C7C-4E74-B73C-5EA278E9EB71}';
IID_ISkpTexture: TGUID = '{FE2473EA-2BF1-460B-BC15-3F9560F78BA0}';
IID_ISkpLayers: TGUID = '{D00F5B9C-77DD-4EAA-9885-AEB6EEB177CF}';
IID_ISkpLayer: TGUID = '{EB0A8A47-D3D3-486E-8F96-626E8F0A1670}';
IID_ISkpOptionsManager: TGUID = '{31A3B2BA-D512-473D-9289-2709BDBF2D1D}';
IID_ISkpOptionsProvider: TGUID = '{120A278B-61BF-49C9-8A5C-4045D5631DCC}';
IID_ISkpNamedValues: TGUID = '{1513EB56-F0D5-41D0-BC71-7DB252A9032A}';
IID_ISkpNamedValue: TGUID = '{03B1BA1E-3A11-492B-9F4F-7B5BC7C28922}';
IID_ISkpComponentDefinitions: TGUID = '{EE7FB267-8EA2-4A5C-9121-28E45FC46AF3}';
IID_ISkpComponentDefinition: TGUID = '{9E729685-B603-47D4-AF2C-049A89AF95B3}';
IID_ISkpOpenings: TGUID = '{C8FB2F03-FE52-4716-B260-C372C4B5C002}';
IID_ISkpOpening: TGUID = '{90EAE5C7-BC47-4B38-9301-11CC2F389F6C}';
IID_ISkpComponentInstance: TGUID = '{CE351997-ABF3-434F-88D9-CDA079FA6873}';
IID_ISkpTransform: TGUID = '{0EBA7013-9266-4F35-9056-B3187000973B}';
IID_ISkpEntities: TGUID = '{8D3949A7-0A77-48B8-9295-EF5546998F6B}';
IID_ISkpEntity: TGUID = '{84AA31DA-5074-42B5-950A-F46E33EF5BB8}';
IID_ISkpComponentInstances: TGUID = '{152994E6-DD1D-4C50-AADD-BB7CDD25593E}';
IID_ISkpCamera: TGUID = '{62DFE658-E514-4797-ADBC-FA7A0A2A22AB}';
IID_ISkpPages: TGUID = '{6EDF2146-2D2C-4045-BE56-FB9999D979D5}';
IID_ISkpPage: TGUID = '{E4A81C66-9699-44A5-9A10-6394B253E43C}';
IID_ISkpCoordinateSystem: TGUID = '{40723364-9619-4CA8-BE77-25ABA612958C}';
IID_ISkpPlane: TGUID = '{1AC7CB56-7C6A-4E9D-A274-4DCE1C5C9749}';
IID_ISkpStyle: TGUID = '{CEDEF8D7-A41B-4964-8B3D-D6C010BDFF9E}';
IID_ISkpSelectionSet: TGUID = '{6ABECF30-A0D8-4369-BB1F-94ABD0FD20C4}';
IID_ISkpRenderer: TGUID = '{C7D9298D-9F63-4AB1-B96C-A8FB96F9BA08}';
IID_ISkpStyleManager: TGUID = '{351E3A4E-E919-43EB-A17C-C01376DB2EC9}';
IID_ISkpStyles: TGUID = '{36C97FB6-D9CC-4FAF-BBE2-D579B699DFAB}';
IID_ISkpHLRView: TGUID = '{7E9855DB-E4D8-40D2-8E30-F4F026674E34}';
IID_ISkpCameraM: TGUID = '{E390B61E-C271-4CB1-9793-2CA57EC19C7B}';
IID_ISkpTextureWriter: TGUID = '{BBD2EED1-8DA6-4F4D-8E92-8A18083104B7}';
IID_ISkpFace: TGUID = '{02228DDC-5252-499A-B8DA-EC7F1BBA1ED8}';
IID_ISkpEdgeUses: TGUID = '{0E8633C5-2129-45E0-8628-15FE25D314DA}';
IID_ISkpEdgeUse: TGUID = '{31B41CF2-8C8A-48BA-B8D8-837B7E86676F}';
IID_ISkpEdge: TGUID = '{2840457C-FA4F-4CBB-93D3-088DD4D4E338}';
IID_ISkpCurve: TGUID = '{EC4F4363-D5F9-42AF-BBBF-BAED0A9501AD}';
IID_ISkpEdges: TGUID = '{108747BB-8B0C-46EF-A371-223B849CC2CA}';
IID_ISkpVertex: TGUID = '{A578615C-F813-4BBA-9C1F-5E01ABF197A6}';
IID_ISkpFaces: TGUID = '{AF7B67C6-151F-469E-B683-998B7B7D8FA2}';
IID_ISkpLoops: TGUID = '{CBCCFB83-CD00-45A1-A631-07DCBA4B842F}';
IID_ISkpLoop: TGUID = '{42798DB5-F496-4F69-9555-81FEB05573F0}';
IID_ISkpVertices: TGUID = '{43CAB51D-29DF-4AD0-8DF1-3D461D32885C}';
IID_ISkpCorrectPerspective: TGUID = '{B1808685-CEF0-42E2-AA0F-8F9570C6F09D}';
IID_ISkpPolygonMesh: TGUID = '{54860340-05E1-4837-AEFC-BD265F7D9375}';
IID_ISkpUVHelper: TGUID = '{2EE945F0-DBAE-4FF3-8119-64AF9378C01D}';
IID_ISkpImage: TGUID = '{355842C5-1938-4120-93D9-A9126147400C}';
IID_ISkpViewProvider: TGUID = '{8044FCF8-16C9-43F9-BB3C-B93983151E3E}';
IID_ISkpHLRWriter: TGUID = '{8C930912-0653-4ADC-99E4-3438DE820D6C}';
IID_ISkpHLRGeneration: TGUID = '{80ACB93F-E86E-4198-90BE-17805448CA0C}';
IID_ISkpAttributes: TGUID = '{3E9D8816-993A-4C3B-9427-3458C9280AE9}';
IID_ISkpAttribute: TGUID = '{D1A0D3D4-A608-4840-A646-2D6CA547C34C}';
IID_ISkpFaceTextureCoordsAttribute: TGUID = '{9EA3F921-C6D0-4FC0-B0E2-A397FF2EEA39}';
IID_ISkpAttributeDictionary: TGUID = '{B091771F-1144-4AF9-9FA3-A8D7147D42B7}';
IID_ISkpArcCurve: TGUID = '{A5A4B9B7-3384-4750-B43B-33C788E7FFC3}';
IID_ISkpLineCurve: TGUID = '{BD4EEF9E-B1D1-4FE1-A835-6EA9568AADC1}';
IID_ISkpDrawingElement: TGUID = '{85195406-7341-443C-AFCD-395EF30954F6}';
IID_ISkpEntityTransformPairs: TGUID = '{4648DE5B-1584-4748-8F82-FAEDDAF0158F}';
IID_ISkpEntityTransformPair: TGUID = '{44ACF88B-DE77-4C84-BA20-90D05C684416}';
IID_ISkpTextures: TGUID = '{08FAA070-8E8D-49AA-B691-350E803A593B}';
IID_ISkpText: TGUID = '{D45DAAEC-1E6C-4908-8C3F-168838AA0B4B}';
IID_ISkpTexts: TGUID = '{3A09F67E-C54A-404A-8C46-D7F35576CDD6}';
IID_ISkpSectionPlane: TGUID = '{22B29B28-69BB-49BE-92BA-8D2509EA8C3A}';
IID_ISkpSectionPlanes: TGUID = '{5B27CB66-EE1B-4ED8-9898-F0DA064FAB30}';
IID_ISkpDimension: TGUID = '{738115B6-B41C-4EE4-94C1-E48AE59B225D}';
IID_ISkpDimensionStyle: TGUID = '{FE6A3A09-EE20-4DE1-A4C9-346AF3B95DBF}';
IID_ISkpDimensionLinear: TGUID = '{8AD10337-A9CE-4281-89FA-EE6ADA9C242D}';
IID_ISkpDimensionRadial: TGUID = '{663E44A6-13A5-43B8-B216-8277B9E1AE1E}';
IID_ISkpDimensions: TGUID = '{9DD5AFA7-10BC-4537-8793-CDCF86CEB17E}';
IID_ISkpGroup: TGUID = '{92868017-548A-40AA-843E-19F20114D00A}';
IID_ISkpGroups: TGUID = '{0D7263FC-4F37-46EC-B518-4FF92D40BC3D}';
IID_ISkpConstructionLine: TGUID = '{1BBD3AAA-C3A2-4C54-B8EC-FDD3A148BBFB}';
IID_ISkpConstructionLines: TGUID = '{EA8BDFA0-D3A0-4196-923B-65E39468EBC6}';
IID_ISkpConstructionPoint: TGUID = '{D14336D5-5378-4B8A-8BEE-A35D92CAEA86}';
IID_ISkpConstructionPoints: TGUID = '{B1409D01-70CB-4AC8-93C2-94A406C42BFB}';
IID_ISkpPolyline3d: TGUID = '{A17CE198-CFCF-4F39-80A2-6A6512CF1E4B}';
IID_ISkpPolyline3ds: TGUID = '{5BF6968B-7C46-4045-A6D8-5CF4CC600C7D}';
IID_ISkpImages: TGUID = '{80EC0989-9FE2-4996-A93C-8DD0611FE3B7}';
IID_ISkpEntityProvider: TGUID = '{16BB046B-9742-4670-81C0-77C0804E2931}';
IID_ISkpEntityProviderStatistics: TGUID = '{B294B3BA-7043-4714-BC7F-3F1F4FCA6947}';
IID_ISkpFileReader: TGUID = '{D9B338BF-6B14-4813-AB17-DA7E7C64CAB5}';
IID_ISequentialStream: TGUID = '{0C733A30-2A1C-11CE-ADE5-00AA0044773D}';
IID_IStream: TGUID = '{0000000C-0000-0000-C000-000000000046}';
IID_ISkpStyleManagerM: TGUID = '{91CC81C5-3060-4E42-B119-FBF6485C5E2B}';
IID_ISkpStyleM: TGUID = '{D8B976E3-7D3B-4938-A9AB-7154666261C0}';
IID_ISkpInputPointFinder: TGUID = '{4861A4BE-32EE-4C5D-8B88-350D0463E445}';
IID_ISkpNamedValuesM: TGUID = '{6F13DFAB-D068-44DB-88E6-3D0F22C8BFFB}';
CLASS_SkpCurve: TGUID = '{F14F48BC-A565-4C4A-B89D-B937A7C3F92F}';
CLASS_SkpArcCurve: TGUID = '{B3DB0982-7499-4DA9-A2E2-5C8CDF83A03E}';
CLASS_SkpLineCurve: TGUID = '{4A1AB8BE-7F80-4CD5-B45A-B647C01BCBD5}';
CLASS_SkpBoundingBox3d: TGUID = '{49AD9805-4DE2-46B7-B10B-543D37E8E34C}';
CLASS_SkpDimensions: TGUID = '{7860E6D1-C06A-409C-ACBC-7A028C89BEE8}';
CLASS_SkpDimensionStyle: TGUID = '{14BB888F-6B45-4C84-885C-6D9C81C0431C}';
CLASS_SkpDimensionRadial: TGUID = '{68A7A031-0A69-434D-9D76-2A9EF6DD2E95}';
CLASS_SkpDimensionLinear: TGUID = '{2A964D77-D81E-4D1B-84A8-8F4703237A8B}';
CLASS_SkpFont: TGUID = '{654DE6F5-EF09-4AB1-8B13-58EA07E91AE2}';
CLASS_SkpFonts: TGUID = '{8DBA2A17-8693-41B4-950F-35AA18BC9E6E}';
CLASS_SkpView: TGUID = '{AFD3FC6D-518B-4783-AA70-4F71A1B20DC5}';
CLASS_SkpText: TGUID = '{2F890771-B9CB-4428-9C66-8C8A3557A217}';
CLASS_SkpTexts: TGUID = '{BF6E4AE8-A322-4602-833F-C39D25630538}';
CLASS_SkpOptionsManager: TGUID = '{27BB57D5-F11E-4EB5-B39A-C9DB40023B48}';
CLASS_SkpOptionsProvider: TGUID = '{9D16F3A7-3A4F-4036-A422-E70DC31D5A38}';
CLASS_SkpFaceTextureCoordsAttribute: TGUID = '{DD8A0680-D541-4557-A265-6FAA2EC51A87}';
CLASS_SkpAttributeDictionary: TGUID = '{E60D14BB-2B0A-4D00-A82A-5584273629F9}';
CLASS_SkpAttribute: TGUID = '{CACB1EA7-619B-4209-B308-BDFCF086DAF7}';
CLASS_SkpAttributes: TGUID = '{0ADF95E1-BA0D-4588-B0F4-9FD3EF8DB5F4}';
CLASS_SkpPlane: TGUID = '{41F635F4-FFAC-4F67-9E3E-3223816767F1}';
CLASS_SkpNamedValue: TGUID = '{A6202410-06BB-4DCD-B575-14B2C4476E1C}';
CLASS_SkpEntities: TGUID = '{AD6339AA-D127-47E4-A0A6-8AFB2B8D79E9}';
CLASS_SkpPolygonMesh: TGUID = '{051594E4-D5C2-4988-BBE2-01E23DA53E50}';
CLASS_SkpFace: TGUID = '{3AC00E24-2B2F-4368-95C0-9FFA0F305AFD}';
CLASS_SkpFaces: TGUID = '{2CCE567F-25AD-4523-9F79-6A42A76F7403}';
IID_ISkpTextureWriter2: TGUID = '{5470F0F3-7883-4EF2-881F-9CA1DA8DD0E8}';
CLASS_SkpTextureWriter: TGUID = '{7915DD58-5887-4CF5-A802-6A517665E535}';
CLASS_SkpApplication: TGUID = '{FCD8BDD9-F12C-4646-9829-5387D844C5E1}';
IID_ISkpAttributeProvider: TGUID = '{4E8E2CD6-3A33-41EA-A725-6579E40F08D1}';
IID_ISkpThumbnailProvider: TGUID = '{E47E315D-9C39-444D-B91F-12AA14EFC484}';
IID_ISkpFileWriter: TGUID = '{562CEEEE-91BF-4296-8F72-5635E7412FA7}';
CLASS_SkpDocument: TGUID = '{27E7D638-4E08-4C2C-8BD0-2DE34BC896EA}';
CLASS_SkpEdge: TGUID = '{D434F6F4-D7F8-42D7-9F63-B2AA4D609E50}';
CLASS_SkpEdges: TGUID = '{13F82ADC-269F-4D7E-89C4-508786C3B8CB}';
CLASS_SkpNamedValues: TGUID = '{CD2F8CCA-8B04-4567-B152-48C3B12D2768}';
CLASS_SkpVertex: TGUID = '{48A28EA9-844F-4260-8BC1-EEFA394E9DB4}';
CLASS_SkpVertices: TGUID = '{2B9FB964-B154-4969-B356-F5E3CF81EFDC}';
CLASS_SkpLayer: TGUID = '{3A62EB90-9625-4F3E-AFC6-A4DFC3D11A5E}';
CLASS_SkpLayers: TGUID = '{35E1EF8A-CD0D-490A-B493-A78841D79290}';
CLASS_SkpMaterial: TGUID = '{2510264C-96DC-4FC4-88B9-E2503F49A8DD}';
CLASS_SkpMaterials: TGUID = '{3307BAAB-4624-4423-B076-37AB33F3EE6A}';
CLASS_SkpTexture: TGUID = '{19356807-23AB-4A7B-AC98-C77381141A5D}';
CLASS_SkpTextures: TGUID = '{F4728C8E-AA35-4092-AD8E-B8090A6A9EDE}';
CLASS_SkpTransform: TGUID = '{25D39F1B-0A6F-4A8A-ABAC-9FE56BE4D45E}';
CLASS_SkpComponentDefinition: TGUID = '{2C39F89C-458F-4435-BA79-8ED3CEAE9068}';
CLASS_SkpComponentDefinitions: TGUID = '{09A855B9-440D-4EC0-BCCF-DBD1E2C6AAF5}';
CLASS_SkpComponentInstance: TGUID = '{1ABECA09-D994-4EB4-8421-747F7C12E2D8}';
CLASS_SkpComponentInstances: TGUID = '{23623210-E18A-43B5-AF25-F259DF138024}';
CLASS_SkpEdgeUse: TGUID = '{682A0B04-C07B-4ED1-963A-8E776CF83085}';
CLASS_SkpEdgeUses: TGUID = '{3FDE8661-D7D6-4C34-ABEB-FA55A60A6771}';
CLASS_SkpLoop: TGUID = '{0D6DB7C0-3DDB-49CB-BB65-B93597609104}';
CLASS_SkpLoops: TGUID = '{1A39AA92-1B88-4512-AE26-2F86CBBC2D84}';
CLASS_SkpPolyline3d: TGUID = '{3BB792D4-B6B8-417A-8C5B-ED3CA179140E}';
CLASS_SkpPolyline3ds: TGUID = '{7A5B60ED-E4E5-4229-96E9-DFB339861AFA}';
CLASS_SkpConstructionLine: TGUID = '{5812305B-4102-4B5F-AF49-A1D781ED8241}';
CLASS_SkpConstructionLines: TGUID = '{F8F0804E-5DB3-4396-A9B1-1778A1E3A1CF}';
CLASS_SkpConstructionPoint: TGUID = '{4031A3A9-5D14-4BA4-9119-7B89D4605AC4}';
CLASS_SkpConstructionPoints: TGUID = '{C53AFEFC-2D79-45B2-A538-9C38956471D6}';
CLASS_SkpGroup: TGUID = '{1594CED1-F405-40C4-9776-E8D1422EDA12}';
CLASS_SkpGroups: TGUID = '{E9D42944-0F9B-405C-B31F-41FD03EEF9D5}';
CLASS_SkpImage: TGUID = '{CE5F0306-2A7C-4C75-8D52-16A5115C2747}';
CLASS_SkpImages: TGUID = '{A00A8FB0-1EB4-4530-8C60-318FA96F5CC0}';
CLASS_SkpCamera: TGUID = '{A4FCD122-86D6-4B7A-B151-FE3EE14A978B}';
CLASS_SkpPage: TGUID = '{6BAC97E8-48D7-4D4C-A079-F1018C0844A3}';
CLASS_SkpPages: TGUID = '{52E11A33-1143-49EE-A82F-5191060FAC05}';
CLASS_SkpEntityTransformPair: TGUID = '{5A875310-D0D3-4BA5-BC95-D8C1BC7DFFBC}';
CLASS_SkpEntityTransformPairs: TGUID = '{68DCA68F-5D93-4E90-9245-11159BC6C1FD}';
CLASS_SkpOpening: TGUID = '{0B357E1E-6BCD-4056-BF1A-55B7B6E2BCFB}';
CLASS_SkpOpenings: TGUID = '{05D8F76C-74B9-4CB6-94BB-B38C2FCB7991}';
CLASS_SkpPoint3d: TGUID = '{55EE31FA-25CB-4293-AEB2-31884694688B}';
CLASS_SkpVector3d: TGUID = '{05EB8168-4E72-4024-9F17-5E9D3BED4B72}';
CLASS_SkpSelectionSet: TGUID = '{D051308C-6EBA-48F0-B8A2-7438FFBF06F4}';
CLASS_SkpSectionPlane: TGUID = '{80600D2D-009F-4904-975B-752D9B8BAAA0}';
CLASS_SkpSectionPlanes: TGUID = '{9CE03B4D-6833-43C4-BED8-6A37D78C2085}';
CLASS_SkpUVHelper: TGUID = '{47E17463-97A6-4026-83FC-E0CFF4928B6E}';
CLASS_SkpCoordinateSystem: TGUID = '{17496FE0-F9D0-4297-8F77-5CC879D8381E}';
CLASS_SkpEntityProviderStatistics: TGUID = '{56C28985-CF66-43DC-ABF6-EDF774EBDB12}';
CLASS_SkpRenderer: TGUID = '{56C28985-CF66-43DC-ABF6-EDF774EBDB13}';
CLASS_SkpStyleManager: TGUID = '{B9AAEAC5-0EC8-4E7C-908F-6F6CE0A5EE19}';
CLASS_SkpStyle: TGUID = '{C8BC9942-B8F1-439D-AF85-8AFDC873190E}';
CLASS_SkpStyles: TGUID = '{5B8D9FBF-260C-409C-AD2C-2F908C6656D5}';
CLASS_SkpCameraM: TGUID = '{2231CC58-63BA-4BAF-B800-ABD9CC8B401D}';
CLASS_SkpNamedValuesM: TGUID = '{D43DB17A-D44D-4CCC-B556-AB8C3E178149}';As you can see, you have everything that Sketchup ruby has. For example, the Document object...
ISkpDocument = interface(IUnknown)
['{E6E72823-A815-4760-91A1-76CED4F4AA60}']
function Get_Application(out pVal: ISkpApplication): HResult; stdcall;
function Get_ModelExtents(out pVal: ISkpBoundingBox3d): HResult; stdcall;
function Get_Fonts(out pVal: ISkpFonts): HResult; stdcall;
function Get_Materials(out pVal: ISkpMaterials): HResult; stdcall;
function Get_Layers(out pLayers: ISkpLayers): HResult; stdcall;
function Get_OptionsManager(out pVal: ISkpOptionsManager): HResult; stdcall;
function Get_ComponentDefinitions(out pDefinitions: ISkpComponentDefinitions): HResult; stdcall;
function Get_CurrentCamera(out pVal: ISkpCamera): HResult; stdcall;
function Get_Pages(out pVal: ISkpPages): HResult; stdcall;
function Get_SelectionSet(out pVal: ISkpSelectionSet): HResult; stdcall;
function Get_Description(out pDesc: WideString): HResult; stdcall;
function Get_Renderer(out pVal: ISkpRenderer): HResult; stdcall;
function Get_ShadowOptions(out ppShadowOptions: ISkpOptionsProvider): HResult; stdcall;
function Get_StyleManager(out pVal: ISkpStyleManager): HResult; stdcall;
function Get_ModelExtentsLLA(out pVal: ISkpBoundingBox3d): HResult; stdcall;
function Get_HLRView(out pVal: ISkpHLRView): HResult; stdcall;
function Get_CurrentCameraM(out pVal: ISkpCameraM): HResult; stdcall;
end;You can access everything using this, so that's why I'm puzzled as to why we need ruby at all. As far as I can tell, all we have to find is the Sketchup interface, and from there, we just have to query the interface for the active model and on an on.
...am I missing something? Or perhaps I don't know what I'm talking about or how Sketchup works at all???
-
Is there a compiler switch in MSVC to compile as a .so rather than a DLL?
Is the rest of the logic the same - for example the call to void Init_XXX() where XXX.so is the name of the .so file?
Thanks,
Al
@dan rathbun said:
@alienizer said:
I totally agree, and we should be able to write plugins entirely in a dll.
There is a future pitfall for DLL files. Their support has been removed for the Ruby 1.9.x branch (which we are hoping that Sketchup begins using soon. Unicode string support etc.)
Anyway... the require() method will not load files with a DLL extension in Ruby 1.9.xYou do not need a real DLL file (to write a Sketchup plugin,) unless you are exporting DLL functions for public use by other non-Sketchup / non-Ruby programs.
Compile as a .so (source object) file if a DLL is not necessary.
BTW... you can always use the WinAPI C call LoadLibrary() to load a DLL. You can make the call using the Ruby Win32API.so extension, or Daniel Berger's newer win32-api package.
-
@al hart said:
Is the rest of the logic the same - for example the call to void Init_XXX() where XXX.so is the name of the .so file?
YES, because this requirement is hardcoded into Ruby. The require() method eventually calls dln_load() and other C routines in dln.c, which must know what the lib's entry point is. I think it is a simple and elegant solution, to use the lib's filename as part of the entry point init function. (Much easier than specifying some memory offset into the lib's code in an additional argument to the require method.)
- So because Ruby uses the lib's filename as part of the init function name, the lib file cannot be renamed after the fact by end user's, and still work.
-
@al hart said:
Is there a compiler switch in MSVC to compile as a .so rather than a DLL?
-
@al hart said:
@al hart said:
Is there a compiler switch in MSVC to compile as a .so rather than a DLL?
Not that I can see... Ruby's mkmf script (the makefile generator,) seems to set .so as the default shared library file type.
So you'd need to compile at the command line, see examples in the sticky post.
To me it does look easier to create DLL with MSVS (the .def files simple to understand.)
There's not much differnce between a so and a dll, and you really don't need to worry about it until Sketchup actually supports Ruby 1.9.x, which may be years.
-
Just wish to also stress this fact from my previous post, that even with the Ruby 1.9.x lack of require() support for DLL files, ...
@dan rathbun said:
... you can always use the WinAPI C call LoadLibrary() to load a DLL. You can make the call using the Ruby Win32API.so extension, or Daniel Berger's newer win32-api package.
... and also Ruby 1.9.x replaces the Win32API.so binary file with a script named Win32API.rb, that maps old Win32API calls into DL module calls.
-
New 'old' info.
I found the old thread where we discussed this over on the Ruby Installer forum. Luis says on Windows that .so files are just renamed .dll files.
See: ruby uses .so files?
Advertisement