Skip to content

Add free (Win32) function support for windows-rdl#3873

Merged
kennykerr merged 12 commits intomasterfrom
rdl-apis
Feb 6, 2026
Merged

Add free (Win32) function support for windows-rdl#3873
kennykerr merged 12 commits intomasterfrom
rdl-apis

Conversation

@kennykerr
Copy link
Collaborator

Building on #3861, this update adds parsing support for Win32-style free functions. These are traditional API functions like CreateProcess or CoInitialize. Here's an example of a .rdl definition:

mod Test {
    #[link(name = "ticker.dll", abi = "system")]
    fn GetTickCount() -> u32;

    #[link(name = "version.dll", abi = "C")]
    fn GetVersion() -> u32;
}

Under the hood, this is a little more complicated as ECMA-335 doesn't like the idea of methods without an associated type. So such methods are added to a special per-namespace type called "Apis":

.class public auto ansi sealed Test.Apis
	extends [mscorlib]System.Object
{
	.method public hidebysig static pinvokeimpl("ticker.dll" nomangle winapi) 
		uint32 GetTickCount () cil managed 
	{
	}
	.method public hidebysig static pinvokeimpl("version.dll" nomangle cdecl) 
		uint32 GetVersion () cil managed 
	{
	}
}

The same goes for Win32 style constants like CO_E_NOTINITIALIZED but I'll get constants working separately.

@riverar
Copy link
Collaborator

riverar commented Feb 6, 2026

@kennykerr
Copy link
Collaborator Author

Thanks, probably with a more realistic example. 🙃

@kennykerr kennykerr merged commit ea558c6 into master Feb 6, 2026
32 checks passed
@kennykerr kennykerr deleted the rdl-apis branch February 6, 2026 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments