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

TypeError: expected CFunctionType instead of int #9

Open
JiaPai12138 opened this issue Oct 21, 2024 · 3 comments
Open

TypeError: expected CFunctionType instead of int #9

JiaPai12138 opened this issue Oct 21, 2024 · 3 comments

Comments

@JiaPai12138
Copy link

JiaPai12138 commented Oct 21, 2024

while trying to load onnxruntime_pybind11_state.pyd in memory, it gives me error:

File "test.py", line XXX, in build_import_table
    funcref.contents = GetProcAddress(hmod, cast(importordinal, LPCSTR))
    ^^^^^^^^^^^^^^^^
TypeError: expected CFunctionType instead of int
# I just copy & paste the content of __init__.py to test.py

Simple test code:

if __name__ == '__main__':
    import sys
    import importlib.util
    import importlib.metadata

    content = open('d:\\Python312\\Lib\\site-packages\\onnxruntime\\capi\\onnxruntime_pybind11_state.pyd', 'rb').read()
    dll = MemoryModule(data=content, debug=True)
    print('test for fun !')
    sleep(10)
    exit()

install onnxruntime module: (python 3.12.7)

pip install onnxruntime-directml==1.19.2

By the way, if test with onnxruntime==1.19.2, works fine
For 'onnxruntime-gpu==1.19.2, it will just exit without printing

FYI: python 3.11 version of onnxruntime-directml will have the same error

@JiaPai12138
Copy link
Author

JiaPai12138 commented Oct 21, 2024

And 'entry_imports[j].name' returns None (for onnxruntime-directml)

@naksyn
Copy link
Owner

naksyn commented Oct 21, 2024

Try with python 3.10.9

@JiaPai12138
Copy link
Author

JiaPai12138 commented Oct 22, 2024

Try with python 3.10.9

Exactly the same error

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