twinBASIC Update: July 2, 2023

Highlights include support for vbaObjAddRef, improvements to the Problems pane, and twinBASIC moving up the BASIC-like language rankings.

twinBASIC Update: July 2, 2023

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.

Here are some links to get involved with the project:


Highlights

Internal Implementation of vbaObjAddRef MSVBVM60 DLL

As part of twinBASIC's 100% backward-compatibility promise, all of the methods of the msvbvm60.dll are being reimplemented in native twinBASIC.  

This is being done for two primary reasons:

  1. To ensure that twinBASIC has no external dependencies (msvbvm60.dll is the one external dependency for VB6)
  2. To provide 64-bit support for all msvbvm60.dll methods and functions (msvbvm60.dll is 32-bit only)

To avoid having to make changes to legacy code, twinBASIC automatically redirects API calls made to msvbvm60.dll functions and methods to its own internal implementations.

Wayne described this feature in GitHub issue 360:

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.

Additional context
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.

The most common API calls have been reimplemented for some time now, but a new one was added in BETA 344.  Here are Wayne's notes:

Indeed, we've got vbaObjSetAddref redirected to an internal implementation, but not vbaObjAddref.  I'll get that added, thanks.

vbaObjAddref support added in BETA 344.  Thanks!

Filtering the Problems Pane

DaveInCaz proposed this improvement last week:

Is your feature request related to a problem? Please describe.
After loading VB6 projects into tB (beta 340) I tend to get hundreds of entries in the Problems pane. Many warnings, some errors. The length makes it inefficient to work with.

Describe the solution you'd like
It would be convenient if we could filter that list by type (error vs. warning) and by module. To some extent the latter can be done by opening/collapsing nodes but this is a bit slow to do by hand. (A collapse-all option would help).

An option to filtering to "current module" might be the way to go.

I like the spare nature of most of the tB IDE GUI and I'm reluctant to recommend adding clutter, but in this case it seems like some added controls for filtering would be helpful.

With the release of BETA 346, a few of these concerns have been addressed:

  • PROBLEMS panel context menu now offers a 'Collapse all' option
  • PROBLEMS panel context menu now offers a 'Expand all' option
  • PROBLEMS panel now has selected total counts in the panel title, for filtering the results

Around the Web

twinBASIC Overtakes FreeBasic in the Slant.co Rankings

In slant.co's list of "Best BASIC-Like Programming Languages," twinBASIC overtook FreeBasic this week to claim the third spot:

Changelog

Here are the updates from the past week.  You can also find this information by visiting the GitHub twinBASIC Releases page.

Releases · WaynePhillipsEA/twinbasic
Contribute to WaynePhillipsEA/twinbasic development by creating an account on GitHub.

WARNING: The following issue is present in BETA builds 202 - 346 (the latest build as of publication):

  • there are known memory leaks in these versions, so memory usage will be higher than normal

BETA 342

  • improved: some performance improvements for compiler parsing/resolving, most notable in larger projects such as tbShellLib

BETA 343

  • improved: further compilation time performance improvements, particularly for compiling large projects

BETA 344

  • fixed: UserControl GotFocus internal event handling could throw an unhandled error [ Tecman, discord ]
  • added: redirection of MSVBVM60::__vbaObjAddref to internal implementation, for X64 support [ https://github.com//issues/360#issuecomment-1608845972 ]

BETA 345

  • fixed: ListView column Width property not taking into account of container ScaleMode [ AntsAntix, discord ]

BETA 346

  • fixed: unterminated With-block could cause a compiler restart [ fafalone, discord ]
  • improved: PROBLEMS panel context menu now offers a 'Collapse all' option
  • improved: PROBLEMS panel context menu now offers a 'Expand all' option
  • improved: PROBLEMS panel now has selected total counts in the panel title, for filtering the results [ https://github.com//issues/1594 ]

All original code samples by Mike Wolfe are licensed under CC BY 4.0