Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do I integrate compiled .NET code with QuickMacros?
#2
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:

Code:
Copy      Help
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.

Code:
Copy      Help
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)


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)