Skip to content

C# Guidelines

Aman Priyadarshi edited this page Dec 21, 2016 · 5 revisions

Exceptions

  • Usage
  • throw new Exception("message");
  • try and catch
  • Implementation
  • ECX register stores pointer to exception object.
  • Value of ECX is tested after calling a function. if NOT NULL exception is passed.
  • Thus ECX should be cleared to Zero if exception is not expected.

DllImport

  • For loading and linking binaries at Runtime
using System.Runtime.InteropServices;
...
[DllImport("disk0/main.o", EntryPoint = "AddTwoNumbers")]
public static extern uint Hello(int a, int b);
...
Console.WriteLine(Hello(1, 2));

dllName: Absolute path to binary in mounted device.
EntryPoint(optional): Name of symbol to load. If not set then Compiler will pickup method base name (i.e. Hello).
CallingConvention: Leave empty if calling Atomix compiled binaries. And set it to CallingConvention.StdCall for GCC compiled binaries

Clone this wiki locally