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

Does not work on Windows OS #22

Open
pydemo opened this issue Mar 10, 2020 · 4 comments
Open

Does not work on Windows OS #22

pydemo opened this issue Mar 10, 2020 · 4 comments

Comments

@pydemo
Copy link

pydemo commented Mar 10, 2020

import os
import sys
from ctypes import *

lib = cdll.LoadLibrary(r'myrustlib.dll')
val='tesTTanotheRRtesTTtest'
lib.count_doubles(val)

errors out:


    func = self._FuncPtr((name_or_ordinal, self))
AttributeError: function 'count_doubles' not found

@szabolcsdombi
Copy link

just rename myrustlib.dll to myrustlib.pyd and import should work by name.

@bindy
Copy link

bindy commented Sep 14, 2020

just rename myrustlib.dll to myrustlib.pyd and import should work by name.

Can you paste your code here?
I also get the same error result.
Thanks.

@szabolcsdombi
Copy link

pyd files can be imported by name

>>> import myrustlib
>>> dir(myrustlib)
[...]

make sure myrustlib is on pythonpath, if not just put it next the the py file that imports it.

@szabolcsdombi
Copy link

move myrustlib.pyd to the project's root in this case. the Makefile does this for the .so file on linux. On windows the the so equivalent is dll but it must be renamed to pyd.

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

3 participants