Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't get == to work #268

Open
DangerMouseB opened this issue Oct 21, 2020 · 2 comments
Open

Can't get == to work #268

DangerMouseB opened this issue Oct 21, 2020 · 2 comments

Comments

@DangerMouseB
Copy link

Hi Atila, I've pared this right down:

ex.d:

module ex;
export struct Ex{
    int id;
}
export bool exEquals(Ex exA, Ex exB) {return exA == exB;}

app.d:

import autowrap.python;
mixin(
    wrapAll(
        LibraryName("_bits"),
        Modules(
            "ex"
        )
    )
);

dub.sdl:

name "_bits"
targetType "dynamicLibrary"

configuration "osx" {
    dependency "autowrap:python" path=".../repos/github/symmetryinvestments/autowrap"
    platforms "osx"
    subConfiguration "autowrap:python" "env"             // the python38 configuration doesn't work for me
}

buildType "debug" {
    postBuildCommands "mv lib_bits.dylib _bits.so" platform="osx"
    preBuildCommands "rm -f lib_bits.dylib" platform="osx"
    preBuildCommands "rm -f _bits.so" platform="osx"
}

test_ex.py

from _bits import Ex, exEquals

print(Ex(1) == Ex(1))
print(exEquals(Ex(1), Ex(1)))

% python3 test_ex.py
False
True

I've tried adding opEquals to the struct. I had a quick look through the autowrap code and couldn't see opEquals anywhere though did find some occurrences of opCmp.

Could you double check if it's missing?

I'm on macos (the latest) + using autowrap cloned from github + dub --version -> DUB version 1.23.0, built on Sep 22 2020.

atilaneves added a commit to atilaneves/autowrap that referenced this issue Oct 27, 2020
@atilaneves
Copy link
Collaborator

I don't see how to get it to work with the default pyd backend of autowrap (which is what autowrap:python is under the covers). I've looked at the docs and I think the only way out there is to define opCmp. A workaround is to use the pynih backend after #270 gets merged.

atilaneves added a commit that referenced this issue Oct 28, 2020
@DangerMouseB
Copy link
Author

Understood, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants