Closed hughfuve closed 5 years ago
my guess is that this is something to do with this line...
public partial class Hand : IComparable
The code is trying to use Interfaces, and this is breaking the build, because they're incompatible.
My guess is that the solution will be to build some kind of wrapper inside the code which exposes the methods of the function using the expected CDECL format.
I'm also guessing this is not the place to ask such questions, but I really don't know where else we would ask, and I'm sure I;m not the only one who sees this kind of error, anyone looking for a fix will find this post.
@hughfuve
unmanagedExports V1.2.7
Your package does not related to this project. Look here: https://www.nuget.org/packages/DllExport/
Please read this: https://github.com/3F/DllExport/wiki/Quick-start
Error CS0103 The name 'CallingConvention' does not exist in the current context
You just need to use System.Runtime.InteropServices namespace.
using the expected CDECL format.
Our tool uses Cdecl by default. You don't need to do anything else for your case.
How to reproduce
Trying to build this DLL and expose the functions outside of C# https://www.codeproject.com/KB/game/pokerhandevaldoc/PokerHandEvalSrc.zip
install unmanagedExports through VS nuget package manager Then add name space...
using RGiesecke.DllExport;
then add the following to method definition within the class... DllExport("add", CallingConvention = CallingConvention.Cdecl)]
try to build... and then we get error... Error CS0103 The name 'CallingConvention' does not exist in the current context
Version, configuration, commands:
unmanagedExports V1.2.7 Microsoft Visual Studio Community 2017 Version 15.9.6 VisualStudio.15.Release/15.9.6+28307.344 Microsoft .NET Framework Version 4.7.03056 Installed Version: Community
NuGet Package Manager 4.6.0
Project files, samples:
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using RGiesecke.DllExport;
namespace HoldemHand { public partial class Hand : IComparable {
region Analysis Functions
if DEBUG
endif
... more methods follow...
log