Trying to utilize cards.dll on 64-bit Windows 10

-1

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:

  • adding it as a reference (from within Visual Studio 2015) reference could not be added
  • 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 tried regsvr32.exe cards.dll, (with and without /u and /i) but I get the message: enter image description here

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.

Here's the dumpbin output on it. dumpbin output

c#
.net-assembly
asked on Stack Overflow Nov 4, 2016 by Murray Hertz • edited Nov 4, 2016 by Murray Hertz

1 Answer

0

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);

`

answered on Stack Overflow Nov 5, 2016 by Murray Hertz

User contributions licensed under CC BY-SA 3.0