Stewori / JyNI

Enables Jython to load native CPython extensions.
https://jyni.12hp.de
Other
150 stars 17 forks source link

custom module imported but functions not exported #40

Open adrian-rt opened 2 years ago

adrian-rt commented 2 years ago

Hi,

I wrote my custom module in C for Python and I can imported like this: java -cp jython-standalone-2.7.2.jar:Lib/JyNI.jar org.python.util.jython test.py The problem is that my functions are not exported and I can't call them allthough the module is successfully imported.

test.py contains the following:

import mtrand print(dir(mtrand)) print(mtrand.__file__)

and the output is ['__builtins__', '__doc__', '__file__', '__name__', '__package__', 'mtrand'] If I run the same thing under python2 I can see all the exported funcitons:

`python Python 2.7.18 (default, Mar 8 2021, 13:02:45) [GCC 9.3.0] on linux2 Type "help", "copyright", "credits" or "license" for more information.

import mtrand dir(mtrand) ['author', 'builtins', 'doc', 'file', 'name', 'package', 'test', 'mt_rand', 'mt_rand_ab', 'mt_rand_orig', 'mt_srand']

`

So, why are my functions not exprted with JyNI?

Thank you!

adrian-rt commented 2 years ago

ps: my extension was compiled with cython.