Author Topic: Nasm and C# under linux  (Read 14070 times)

nobody

  • Guest
Nasm and C# under linux
« on: April 27, 2005, 11:22:27 PM »
Hi! I've been trying to make this work, but no success. I have two files:

koxta@limbo csharp $ cat Add.asm
segment .text
        global _Add

_Add:
        push ebp
        mov ebp, esp
        mov eax, 0
        add eax, [esp+8]
        add eax, [esp+12]
        pop ebp
        ret 8

koxta@limbo csharp $ cat main.cs
using System;
using System.Runtime.InteropServices;

public class Whatever {

[DllImport("Add.dll")]
        public static extern int Add(int a, int b);

public static int Main() {

Console.WriteLine("Your sum: {0}", Add(2,3));

return 0;
        }
}

I want to create a dll from .asm and I don't know which tools should I use (dllwrap maybe?). First of all, what parameter do I pass to the -f in order to create an obj file, that would easly be converted into dll?