Skip to content

ability to tell, how many instances of context exist#1950

Merged
borisbat merged 1 commit into
masterfrom
context_shared_counter
Dec 2, 2025
Merged

ability to tell, how many instances of context exist#1950
borisbat merged 1 commit into
masterfrom
context_shared_counter

Conversation

@borisbat
Copy link
Copy Markdown
Collaborator

@borisbat borisbat commented Dec 1, 2025

let shared DLL : void? = null

[init]
def setup {
    if ( get_context_share_counter() == 1ul ) { // IF THIS ONE IS THE FIRST ONE
        unsafe {
            reinterpret<void?>(DLL) = reinterpret<void?>(0x12345678) // mock loading a DLL
        }
    }
}

[export]
def main {
    print("Hello, World!\n")
}

[finalize]
def done {
    if ( get_context_share_counter() == 1ul ) { // IF THIS ONE IS THE LAST ONE
        unsafe {
            reinterpret<void?>(DLL) = null // mock unloading a DLL
        }
    }
}

@borisbat borisbat merged commit 580c7dc into master Dec 2, 2025
42 checks passed
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.

1 participant