05-20-2005, 11:29 AM
I am not familiar with C#, and don't know how to export functions as dll functions. But you can create COM dll. I experimented with it a little. Not perfect, but works.
In project properties, set Register for COM Interop to True. Without this, type library is not created. Add IArithmetic interface, and set the Arithmetic class to implement it. Here is the code:
In QM, add type library declaration, and compile the macro. Then you can view members when you type a period. Create object of type IArithmetic, and call its member functions.
In project properties, set Register for COM Interop to True. Without this, type library is not created. Add IArithmetic interface, and set the Arithmetic class to implement it. Here is the code:
using System;
namespace ClassLibrary2
{
public interface IArithmetic
{
int AddIntegers(int a, int b);
}
/// <summary>
/// Summary description for Class1.
/// </summary>
public class Arithmetic :IArithmetic
{
public Arithmetic()
{
//
// TODO: Add constructor logic here
//
}
#region IArithmetic Members
public int AddIntegers(int a, int b)
{
// TODO: Add Arithmetic.AddIntegers implementation
return a+b;
}
#endregion
}
}In QM, add type library declaration, and compile the macro. Then you can view members when you type a period. Create object of type IArithmetic, and call its member functions.
typelib ClassLibrary2 "C:\Documents and Settings\G\Desktop\ClassLibrary2\bin\Debug\ClassLibrary2.tlb"
;ClassLibrary2.Arithmetic a._create ;;this does not work, because IArithmetic is not default interface (I don't know why)
ClassLibrary2.IArithmetic i._create(uuidof(ClassLibrary2.Arithmetic))
out i.AddIntegers(2 4)