Jump to content
Developer Wiki and Function Reference Links ×

Exception Thrown when calling TXResStr()


Carles Olle

Recommended Posts

I'm compiling DeafultsTools SDK sample but when running the debug version of the plug-in in VectorWorks 2017 an exception is thrown.

 

  • Windows SDK Version: 10.0.17134.0
  • Platform Toolset: Visual Studio 2017 (v141)

 

No compilation error or warnings.

The exception is thrown when inside the VWExtensionTool constructor (VWExtensionTool.cpp):

fstrTitle = TXResStr( toolDef.fTitle.fResNameWithoutPathOrExtension, toolDef.fTitle.fStringIdentifier, eAllowEmptyResult );
toolDef.fTitle.fResNameWithoutPathOrExtension = "ExtObjThePoint"
toolDef.fTitle.fStringIdentifier = "tool_title"
eAllowEmptyResult = 1

 

This is the stack trace

 	DefaultTools.vlb!std::_Container_base12::_Orphan_all() Line 256	C++
 	DefaultTools.vlb!std::_String_alloc<std::_String_base_types<wchar_t,TXAlloc<wchar_t> > >::_Orphan_all() Line 1803	C++
 	DefaultTools.vlb!std::basic_string<wchar_t,std::char_traits<wchar_t>,TXAlloc<wchar_t> >::_Tidy_deallocate() Line 3693	C++
 	DefaultTools.vlb!std::basic_string<wchar_t,std::char_traits<wchar_t>,TXAlloc<wchar_t> >::~basic_string<wchar_t,std::char_traits<wchar_t>,TXAlloc<wchar_t> >() Line 2231	C++
>	DefaultTools.vlb!TXString::~TXString() Line 376	C++
 	[External Code]	
 	DefaultTools.vlb!VWFC::PluginSupport::VWExtensionTool::VWExtensionTool(CallBackBlock * cbp, const VWFC::PluginSupport::SToolDef & toolDef) Line 49	C++
 	DefaultTools.vlb!DefaultTools::CExtObjThePointDefTool::CExtObjThePointDefTool(CallBackBlock * cbp) Line 112	C++
 	DefaultTools.vlb!VWFC::PluginSupport::REGISTER_Extension<DefaultTools::CExtObjThePointDefTool>(const VWIID & groupID, int action, void * moduleInfo, const VWIID & inInterfaceID, IVWUnknown * & inOutInterface, CallBackBlock * cbp, int & reply) Line 349	C++
 	DefaultTools.vlb!plugin_module_main(int action, void * moduleInfo, const VWIID & iid, IVWUnknown * & inOutInterface, CallBackBlock * cbp) Line 41	C++
 	[External Code]	

Do you know if I need to change something in the sample code?

Thanks.

Link to comment

If you use VW SDK 2017 or 2018, you still need to use the toolset v110 of Visual Studio 2012, as the VW SDK is compiled with it.

 

You can use the IDE of Visual Studio 2017 (I do too, as the new Visual Studio is much more comfortable), but you must use the old toolset.

 

I am surprised that you managed to even link the code.

 

 

Edited by Nicolas Goutte
Link to comment

Thanks for the reply Nicolas,

 

I'm using VW SDK 2019 which I downloaded from https://www.vectorworks.net/support/custom/sdk/sdkdown

 

I decided to use Visual Studio 2017 as it is indicated in http://developer.vectorworks.net/index.php/SDK:Vectorworks_2019_Development but it seems they forgot to mention not to use the toolset that comes with VS2017 (is this the right source for the VW SDK documentation?)

 

If I open DefaultTools.vcxproj from the VW SDK 2019 samples folder I see they are using the 2017 toolset (v141):

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
	<ConfigurationType>DynamicLibrary</ConfigurationType>
	<UseDebugLibraries>false</UseDebugLibraries>
	<WholeProgramOptimization>true</WholeProgramOptimization>
	<CharacterSet>Unicode</CharacterSet>
	<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>

It compiles ok using 2017 toolset (v141) but when running the debug version (release version is ok) I get the Exception described above.

 

When I change to 2012 toolset (v110) I get these errors:

 

1>------ Build started: Project: DefaultTools, Configuration: Debug x64 ------
1>StdAfx.cpp
1>c:\users\...\appdata\roaming\nemetschek\vectorworks\2019\sdk\sdklib\include\kernel\GSString.X.h(682): error C2143: syntax error : missing ';' before '{'
1>c:\users\...\appdata\roaming\nemetschek\vectorworks\2019\sdk\sdklib\include\kernel\GSString.X.h(682): error C2275: 'std::hash<_Kty>' : illegal use of this type as an expression
1>        with
1>        [
1>            _Kty=std::u16string
1>        ]
1>c:\users\...\appdata\roaming\nemetschek\vectorworks\2019\sdk\sdklib\include\kernel\MCFloat.h(267): error C2065: 'FP_NORMAL' : undeclared identifier
1>c:\users\...\appdata\roaming\nemetschek\vectorworks\2019\sdk\sdklib\include\kernel\MCFloat.h(267): error C2065: 'FP_SUBNORMAL' : undeclared identifier
1>c:\users\...\appdata\roaming\nemetschek\vectorworks\2019\sdk\sdklib\include\kernel\MCFloat.h(267): error C2065: 'FP_ZERO' : undeclared identifier
1>c:\users\...\appdata\roaming\nemetschek\vectorworks\2019\sdk\sdklib\include\kernel\MCFloat.h(268): error C2065: 'FP_NORMAL' : undeclared identifier
1>c:\users\...\appdata\roaming\nemetschek\vectorworks\2019\sdk\sdklib\include\kernel\MCFloat.h(268): error C2065: 'FP_SUBNORMAL' : undeclared identifier
1>c:\users\...\appdata\roaming\nemetschek\vectorworks\2019\sdk\sdklib\include\kernel\MCFloat.h(268): error C2065: 'FP_ZERO' : undeclared identifier
1>c:\users\...\appdata\roaming\nemetschek\vectorworks\2019\sdk\sdklib\include\kernel\MCFloat.h(269): error C2065: 'FP_ZERO' : undeclared identifier
1>c:\users\...\appdata\roaming\nemetschek\vectorworks\2019\sdk\sdklib\include\kernel\MCFloat.h(269): error C2065: 'FP_SUBNORMAL' : undeclared identifier
1>c:\users\...\appdata\roaming\nemetschek\vectorworks\2019\sdk\sdklib\include\kernel\MiniCadCallBacks.h(2561): error C2065: 'default' : undeclared identifier
1>c:\users\...\appdata\roaming\nemetschek\vectorworks\2019\sdk\sdklib\include\kernel\MiniCadCallBacks.h(2561): error C2253: 'TransferImageEffects' : pure specifier or abstract override specifier only allowed on virtual function
1>c:\users\...\appdata\roaming\nemetschek\vectorworks\2019\sdk\sdklib\include\kernel\MiniCadCallBacks.h(4001): error C2614: 'SymbolImgInfo' : illegal member initialization: 'SymbolImgInfo' is not a base or member
1>c:\users\...\appdata\roaming\nemetschek\vectorworks\2019\sdk\sdklib\include\kernel\MiniCadCallBacks.h(4002): error C2614: 'SymbolImgInfo' : illegal member initialization: 'SymbolImgInfo' is not a base or member
1>c:\users\...\appdata\roaming\nemetschek\vectorworks\2019\sdk\sdklib\include\interfaces\VectorWorks/Extension/IResourceManagerContent.h(29): error C2864: 'VectorWorks::Extension::SSearchProperties::fOnlyCurrentDoc' : only static const integral data members can be initialized within a class
1>c:\users\...\appdata\roaming\nemetschek\vectorworks\2019\sdk\sdklib\include\interfaces\VectorWorks/Extension/IResourceManagerContent.h(30): error C2864: 'VectorWorks::Extension::SSearchProperties::fSearchOnline' : only static const integral data members can be initialized within a class
1>c:\users\...\appdata\roaming\nemetschek\vectorworks\2019\sdk\sdklib\include\interfaces\VectorWorks/Extension/IResourceManagerContent.h(31): error C2864: 'VectorWorks::Extension::SSearchProperties::fSkipCurrentDoc' : only static const integral data members can be initialized within a class
1>Done building project "DefaultTools.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

 

Edited by Carles Olle
Link to comment

Good, if you use VW SDK 2019, that is another story, then you must use toolset V141.

 

The bad news is that under Windows you cannot use Debug version of your plugin in a released VW version... which is compiled as Release. That is has to do with a design choice of Microsoft where the C Runtime of Debug and Release cannot be used together. As, since VW 2018, TXString ist implemented internally as a std::string, you cannot call a TXString from your plug-in through a call using a TXString in VW.

 

Yes, it is super-annoying. You have to fake debug, by using a release target without Optimization. Yes, that means that Edit&Continue and other features working only in Debug cannot be used.

Link to comment
  • 5 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...