Thought this new feature worth highlighting for those that don't follow tB Discord or language design forum regularly.
twinBASIC now supports Naked functions and Emit(), which emits assembly code directly into the compiled exe.
For example, the current InterlockedIncrement intrinsic from my WinDevLib project, currently linked in as a static library (since it's not exported from 64bit kernel32.dll).
Code:
Public Function InlineInterlockedIncrement CDecl Naked(Addend As Long) As Long
#If Win64 Then
Emit(&Hb8, &H01, &H00, &H00, &H00) ' mov eax,0x1
Emit(&Hf0, &H0f, &Hc1, &H41, &H00) ' lock xadd DWORD PTR [rcx+0x4],eax
Emit(&Hff, &Hc0) ' inc eax
Emit(&Hc3) ' ret
#Else
Emit(&H8b, &H4c, &H24, &H04) ' mov ecx, DWORD PTR _Addend$[esp-4]
Emit(&Hb8, &H01, &H00, &H00, &H00) ' mov eax, 1
Emit(&Hf0, &H0f, &Hc1, &H01) ' lock xadd DWORD PTR [ecx], eax
Emit(&H40) ' inc eax
Emit(&Hc3) ' ret 0
#End If
End Function
For more info and examples, see the recent comments to this post: https://github.com/twinbasic/lang-design/issues/65