Invalid expression inside Connector.cs
Opened this issue · 3 comments
The following block of code inside loadEngine()
is not functional:
#if _WIN64
libInst = LoadLibraryW("ce-lib64.dll");
#else
libInst = LoadLibrary("ce-lib32.dll");
#endif
There is no predefined _WIN64 symbol in C#, therefore the first condition will always evaluate to false. This results in the method always loading the 32-bit dll.
Hello Nahnahchi,
For c# examples, I have set up the project with 4 configurations (64b debug, 64b release, 32b debug, 32b release).
If you open the project with vistual studio, you should be able to choose the correct configuration which set the _WIN64 symbol.
In the following file Scanner.csproj, the symbol is defined here :
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE;_WIN64</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
But it's strange because it is not defined with the Debug|x64. Let me know if it works for you with the Release|x64
I see.
I've only checked for this constant in Assembler.csproj, which is the one I was trying to use initially. It doesn't seem to be defined there at all.
You're right this constant is not defined in Assembler.csproj and is not defined for the x64 Debug configuration in the Scanner example.
I'll mark this as bug. For now, you can manually edit the DefineConstants to add the _WIN64 symbol.
Thank you for this report.