How is SciLexer.dll built as distributed with SciTE?

83 views
Skip to first unread message

michael.s...@gmail.com

unread,
May 19, 2016, 4:44:22 PM5/19/16
to scintilla-interest
How do you build Scintilla when distributed with SciTE, Neil? I know just enough about VC++ to be dangerous and I'm seeing different behavior when using my DLL compared to the one bundles with SciTE.

I've downloaded 3.6.5 source and opened .\win32\SciLexer.vcxproj in Visual Studio 2010. The project properties has the Platform Toolset set to v120 so I change that to v100 for VS2010. On the C/C++|Code Generation options I set the Runtime Library to /MT so that I don't have to require the VC++ Redistributable. So far and all seems well. 

Running my application on Windows XP and Server 2003 if I have the caret placed at the end of text and if I press and hold Backspace eventually an Access Violation is thrown in my application. It seems to be a bad string pointer to text returned by the Scintilla SCN_MODIFIED notification. If I disable the SCN_MODIFIED notifications then I have no AV. If I use SciLexer.dll that you bundle with SciTE then I have no Access Violation. I don't see the AV on Windows Server 2008 or newer. This problem is not specific to 3.6.5. I've repeated it with other drops as well.

Can you share how you are building for SciTE or offer any guidance on what I should change about how I'm building?

Thanks,
Michael

michael.s...@gmail.com

unread,
May 19, 2016, 4:45:32 PM5/19/16
to scintilla-interest
Oh, I'm building the Release configuration, Win32.

Neil Hodgson

unread,
May 19, 2016, 7:01:51 PM5/19/16
to scintilla...@googlegroups.com
Michael.staszewsk:

> How do you build Scintilla when distributed with SciTE, Neil?

There is a README file at the top of both the scintilla and scite directories in the distributions. This tells you how to build Scintilla and SciTE.

> Running my application on Windows XP and Server 2003 if I have the caret placed at the end of text and if I press and hold Backspace eventually an Access Violation is thrown in my application.

If you build in debug mode then additional assertions will fire for questionable actions.

Not all notifications have valid text. In those cases text should be NULL. The text pointer is only valid during that notification: do not save the pointer for later access.

Neil

michael.s...@gmail.com

unread,
May 23, 2016, 10:22:58 AM5/23/16
to scintilla-interest, nyama...@me.com
Thanks, I've already viewed the readme and am able to build fine, but for some reason builds coming from my machine behave differently than the precompiled DLL bundled with SciTE. I grabbed the 3.6.5 source once again and built it with Visual Studio 2010 and I get the AVs. I do not with your DLL. I see the same behavior in older versions of Scintilla as well. The only thing I changed from your default project options is that I build the Release configuration and the default project options have Debug active.

> The text pointer is only valid during that notification: do not save the pointer for later access. 

The string is cloned to local memory already in response to WM_NOTIFY message. The AVs surfaced are during the WM_NOTIFY handler while the text pointer is being cloned.

> Not all notifications have valid text.

I'll add some checks to only attempt the string clone for those notifications that have valid text and try again, but that wouldn't explain why your DLL works fine and the one I build does not. I didn't know if there was some build environment setting you could think of that makes my DLL incompatible with older Windows OS.

Thanks,
Michael

Neil Hodgson

unread,
May 23, 2016, 9:45:24 PM5/23/16
to scintilla...@googlegroups.com
Michael.staszewski

> I grabbed the 3.6.5 source once again and built it with Visual Studio 2010 and I get the AVs. I do not with your DLL. I see the same behavior in older versions of Scintilla as well.

I use Visual Studio 2015. With SUPPORT_XP turned on but that isn’t needed and won’t work for Visual Studio 2010.

> I'll add some checks to only attempt the string clone for those notifications that have valid text and try again, but that wouldn't explain why your DLL works fine and the one I build does not. I didn't know if there was some build environment setting you could think of that makes my DLL incompatible with older Windows OS.

Windows XP support was ended by Microsoft in 2014 and their recent compilers have limited and sometimes buggy support for XP. However, Visual Studio 2010 should support XP as long as it has SP 2.
https://www.microsoft.com/en-au/WindowsForBusiness/end-of-xp-support

While there would be benefits to tracking this down and fixing it, it may take much effort so you may be better off using a different compiler, possibly gcc through a MinGW download.

Neil

michael.s...@gmail.com

unread,
May 24, 2016, 11:27:23 AM5/24/16
to scintilla-interest, nyama...@me.com
Thanks, I'll try a new compiler and check the service pack.

> Windows XP support was ended by Microsoft in 2014

Oh, I know and I'm fighting with users now over this. We are officially dropping support for XP and Win 2K3 because of the AV (and since MS dropped support years ago) but if I can get it to work I'd like to. We still have a sizable user population on these antique systems.

Thanks,
Michael
Reply all
Reply to author
Forward
0 new messages