Skip to content

Static Callbacks #1

@ajayre

Description

@ajayre

Many many many thanks for working this out - it has been a massive time saver!!

You can avoid making the callback functions static by holding a class-level reference to the delegates, which will stop them from being garbage collected while the simulation is running. For example:

public delegate int SendChar(string callerOut, int idNum, IntPtr pointer); ... private SendChar SendCharCallback; ... SendCharCallback = new SendChar(SendCharReceive); ... ngSpice_Init(SendCharCallback, ...);

Andy

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions