Hi
I have this working but was just curious if there was a cleaner way of doing
this??
I have a dll that is versioned thru the dll name and I need to support both
versions.
The fcts within the dll are the same for now but who knows in the future.
I need the 2 classes to wrap the unmanged dll. It seems the two classes to
call the managed dll should be
different because calling to the static fcts with the Class names is
claener. If I had interfaces - I could combine these 2 classes
but this seems the best way that I know of ???
Just curious
Thanks
public class MyClass
{
[DllImport("mydll.dll", EntryPoint = "putString")]
public static extern Int16 putString(Int32 nPat, Int16 fieldType, Int16
occurrence, [MarshalAs(UnmanagedType.LPStr)] StringBuilder data);
}
public class MyClassv2
{
[DllImport("mydllv2.dll", EntryPoint = "putString")]
public static extern Int16 putString(Int32 nPat, Int16 fieldType, Int16
occurrence, [MarshalAs(UnmanagedType.LPStr)] StringBuilder data);
}
public class TestDll
{
public TestDll()
{
int rc = 0;
rc= MyClass.putString(1, 1, 1, "Some Text");
}
}
public class TestDll2
{
public TestDll2()
{
int rc = 0;
rc= MyClassv2.putString(1, 1, 1, "Some Text");
}
}