twinBASIC Update: August 22, 2021
Highlights include a sneak-peek at the forthcoming integrated unit testing framework, App.ThreadID, App.hInstance, and MSVBVM60.dll redirections.
On April 23, 2021, I helped Wayne Phillips introduce the world to twinBASIC at the Access DevCon Vienna conference. I boldly predicted that twinBASIC (along with the Monaco editor) would replace VBA and its outdated development environment by 2025. With that goal in mind, this weekly update is my attempt to keep the project fresh in the minds of the VBA development community.
Every Sunday, I will be providing updates on the status of the project, linking to new articles discussing twinBASIC, and generally trying to increase engagement with the project. If you come across items that should be included here, tweet me @NoLongerSet or email me at mike at nolongerset dot com.
Unit Testing Sneak Preview
As I mentioned a couple of weeks ago, Visual Code now offers an integrated testing API. That means integrated testing in twinBASIC is right around the corner. In fact, Wayne posted a teaser this morning:
Partial Implementation of the VB6 App Object
For now, only the
ThreadID properties are provided. Also, they must be called using the predeclared class object
App. For example,
App.ThreadID. Full VB6-compatibility for the App object is forthcoming.
twinBASIC now supports a new enum value for the LoadResPicture function:
vbResBitmapFromIcon. It "allows ICO resources to be loaded as bitmap-based IPictureDisp objects rather than icon-based IPictureDisp objects."
Around the Web
MSVBVM60 DLL Redirections
From Wayne's original post:
Is your feature request related to a problem? Please describe.
There are some useful exported DLL functions from MSVBVM60 that VB6 developers are known to have used in their code via Declare statements. These pose a problem when switching on 64-bit support, since there is no 64-bit version of that DLL.
Describe the solution you'd like
I'd like the twinBASIC compiler to detect Declare statements into known MSVBVM60 endpoints, and redirect them to internal implementations that do the same thing.
Let's start by making a list of the well known and most used exports from MSVBVM60 here so that we can consider them for automatic redirection by tB.
User Kr00l provided a list of commonly used functions. These API calls are now redirected to twinBASIC internal implementations as of v0.10.4755:
If you have functions in your VB6 code base that call into
lib "msvbm60.dll, be sure to add them to the GitHub issue.
Here are the updates from the past week. You can also find this information by installing the twinBASIC VS Code extension and clicking on the Changelog tab of the extension page:
[v0.10.4756, 21st August 2021]
- fixed: compiler crash on ambiguous datatype in param definition [ https://github.com/WaynePhillipsEA/twinbasic/issues/373 ]
[v0.10.4755, 20th August 2021]
- fixed: Erase statement on ByRef-array caused compilation error [ https://github.com/WaynePhillipsEA/twinbasic/issues/367 ]
- fixed: broken Negate operator in some circumstances involving UDT field access [ https://github.com/WaynePhillipsEA/twinbasic/issues/366 ]
- fixed: broken edge case of debugger and For-Each implementation when objects don't correctly expose IDispatch [ https://github.com/WaynePhillipsEA/twinbasic/issues/362 ]
- improved: redirecting the common MSVBVM60 DLL exports to twinBASIC internal routines in preparation for 64-bit support [ https://github.com/WaynePhillipsEA/twinbasic/issues/360 ]
- fixed: Set byref-Variant to Nothing regression [ https://github.com/WaynePhillipsEA/twinbasic/issues/370 ]
- fixed: intellisense showing in comments [ https://github.com/WaynePhillipsEA/twinbasic/issues/337#issuecomment-902681458 ]
- improved: refined vbResBitmapFromIcon support
[v0.10.4628, 20th August 2021]
- fixed: LoadResPicture not always working for ICON and CURSOR types
- added: vbResBitmapFromIcon to allow loading a bitmap based IPictureDisp from an icon resource
- added: optional Width and Height parameters to the LoadResPicture function to allow for loading specific sized icons
[v0.10.4617, 19th August 2021]
- fixed: Set-assignment semantics involving byref-Variants, as discussed at vbforums
- improved: minor intellisense improvements
[v0.10.4563, 17th August 2021]
- added: initial early implementation of VB6 App object, providing hInstance and ThreadID members [ https://github.com/WaynePhillipsEA/twinbasic/issues/143 ]
[v0.10.4503, 17th August 2021]
- fixed: ANSI encoding of BAS and CLS files is now handled approriately according to the system codepage [ https://github.com/WaynePhillipsEA/twinbasic/issues/353 ]
- fixed: codegen bug involving inline ByVal attributes and referencable values [ https://github.com/WaynePhillipsEA/twinbasic/issues/358 ]
- improved: validation of WithEvents fields syntax [ https://github.com/WaynePhillipsEA/twinbasic/issues/357 ]
- improved: intellisense on WithEvents field datatypes, filtering out non-class/interfaces
- fixed: WithEvents field initializers running too early before host object is fully constructed [ https://github.com/WaynePhillipsEA/twinbasic/issues/357 ]
[v0.10.4441, 16th August 2021]
- improved: +/- now trigger intellisense [ https://github.com/WaynePhillipsEA/twinbasic/issues/337#issuecomment-899211308 ]
- fixed: go to definition now works with constants [ https://github.com/WaynePhillipsEA/twinbasic/issues/351 ]
- improved: syntax checking around constant definitions
- improved: the compiler will now detect and flag errors on duplicate components, UDTs, enums and overloads in the same scope [ https://github.com/WaynePhillipsEA/twinbasic/issues/356 ]
[v0.10.4386, 15th August 2021]
- changed default threading model from MTA to STA
- fixed codegen bug involving byref-Variants and temporary variables [ https://github.com/WaynePhillipsEA/twinbasic/issues/354 ]