I have a 3rd party dynamically-linked-library given to me by a vendor. The library is object oriented. I'm currently trying to access this library from either .Net or C#, however, when trying to call methods, no methods are available in .Net Support for these libraries is given by a programmer working with Python. Here is the Python Sample I was given:
import win32com.client
OLSV = Win32com.client.Dispatch("LsvEmu.LsvEmulator")
OLSV.BaseUnit
Here is what I've tried in C#
using System;
using LsvComLib;
using System.Reflection;
using System.Reflection.Emit;
using LsvEmuLib;
namespace LsvDemo
{
class Program
{
static void TestEmu()
{
//LsvEmu should include Connect, and ConnectEx methods
var lsvEmu = new LsvEmulator();
//EmulationMode is a property, and all that is available other
than ToString, etc
Console.WriteLine(lsvEmu.EmulationMode);
//Attempt to use reflection to find a Dispatch equivalent in C#
Type mytype = (typeof(LsvEmulator));
//public
//No further methods found
MethodInfo[] myArrayMethodInfo = mytype.GetMethods(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly);
DisplayMethodInfo(myArrayMethodInfo);
//private
//No further methods found
MethodInfo[] myArrayMethodInfo1 = mytype.GetMethods(BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly);
// Display information for all methods.
DisplayMethodInfo(myArrayMethodInfo1);
}
}
What would be an appropriate equivalent to the Python Dispatch call? Furthermore, why are the expected methods not available through reflection? It seems that this software vendor might not have access to all of the original source code, so I'm not sure how much help they would be. This library is meant to emulate another library they gave to us that makes ethernet calls to their devices. If lack of available methods shown via reflection is due to poor implementation, we may build our own emulator instead.