'Using an object as the parameter of an external function in C#

Let's say I have a timer object in C#:

public class Timer {
    private int currentTime;
    private int lastTime;

    public int GetTimePassed() {
    }
}

Is it possible to use this object as a parameter in an external function? Like so:

public class Program {
    [DllImport("example.dll"), CallingConvention = CallingConvention.Cdecl]
    extern void ExampleFunction(Timer arg);
}
#include <stdio.h>

extern "C" {
    __declspec(dllexport) void ExampleFunction(Timer arg) {
    }
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source