I am trying to utilize the "cards.dll" module to create a visual card game, and I can't seem to figure it out despite all of the Googling I can think to do. I have the DLL file (203,024 bytes) but I'm confused about the "registration" as a .NET or a COM assembly. I have tried:
Explicitly loading it
Assembly a = Assembly.LoadFile(@"/cards.dll");
with the result: The module was expected to contain an assembly manifest. (Exception from HRESULT: 0x80131018)
I have copied the DLL into the C:\Windows\System32 and C:\Windows\SysWOW64 folders as well, but to no avail.
I'm running this (or at least trying to) on a 64-bit Windows 10 machine, with an i5 core.
I figured it out with the information at this link on Catch22.net. The key learnings were: `
static class NativeMethods
{
[DllImport("kernel32.dll")]
public static extern IntPtr LoadLibrary(string dllToLoad);
[DllImport("kernel32.dll")]
public static extern IntPtr GetProcAddress(IntPtr hModule, string procedureName);
}
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate bool cdtInit(ref Int32 width, ref Int32 height);
dll = NativeMethods.LoadLibrary(@"\path\cards32.dll");
IntPtr addr;
addr = NativeMethods.GetProcAddress(dll, "cdtInit");
mycdtInit = (cdtInit)Marshal.GetDelegateForFunctionPointer(addr, typeof(cdtInit));
Int32 width = 71;
Int32 height = 95;
var result = mycdtInit(ref width, ref height);
`
User contributions licensed under CC BY-SA 3.0