Skip to content
This repository has been archived by the owner on Aug 13, 2023. It is now read-only.

Invalid expression inside Connector.cs #23

Open
Nahnahchi opened this issue Jul 21, 2020 · 3 comments
Open

Invalid expression inside Connector.cs #23

Nahnahchi opened this issue Jul 21, 2020 · 3 comments
Labels

Comments

@Nahnahchi
Copy link

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.

@fenix01
Copy link
Owner

fenix01 commented Jul 23, 2020

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

@Nahnahchi
Copy link
Author

Nahnahchi commented Jul 23, 2020

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.

@fenix01
Copy link
Owner

fenix01 commented Jul 23, 2020

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.

@fenix01 fenix01 added the bug label Jul 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants