cxx2rs
cxx2rs copied to clipboard
Convert jvmti header files
Hi, I want to convert JVM Tool Interface header files (jdk1.7.0_79\include). There is no any lib file, just headers.
python.exe cxx2rs C:\Users...\src\jvmti.h > jvmti.rs
Traceback (most recent call last):
File "C:\Python27\lib\runpy.py", line 162, in run_module_as_main
"main", fname, loader, pkg_name)
File "C:\Python27\lib\runpy.py", line 72, in run_code
exec code in run_globals
File "C:\Python27\Lib\site-packages\cxx2rs__main.py", line 13, in
How do I do that? thanks
That path looks pretty incorrect:
C:\Python27\Lib\site-packages\cxx2rs__main_.py
Is that really what the output looks like? It should be something like
C:\Python27\Lib\site-packages\cxx2rs\__main_.py
(Please note the added backslash)
I tried to run a script in your way
but error still occurs
python.exe C:\Python27\Lib\site-packages\cxx2rs__main__.py C:\Users...\src\jvm.h > jvmti.rs Traceback (most recent call last): File "C:\Python27\Lib\site-packages\cxx2rs__main__.py", line 13, in
from parser import canonical_function_name ImportError: cannot import name canonical_function_name
The thing is that all files should be located in the directory C:\Python27\Lib\site-packages\cxx2rs\. In this folder there should be (among other files) the files __main__.py and parser.py.
Could you check if this is the case?
I've installed script by pip, so all files are presented

That's really weird. Could you check if parser.py contains in line 95:
def canonical_function_name(node):
If so, please cd C:\Python27\Lib\site-packages\cxx2rs and run
python.exe C:\Python27\Lib\site-packages\cxx2rs\__main__.py C:\Users...\src\jvm.h > jvmti.rs
from there.
Yes, there is canonical_function_name function at line 95
C:\Python27> python.exe C:\Python27\Lib\site-packages\cxx2rs__main__.py C:\Program Files\Java\jdk1.7.0_79\include\jvmti.h > jvmti.rs
Traceback (most recent call last):
File "C:\Python27\Lib\site-packages\cxx2rs__main__.py", line 13, in
please change the current directory before calling python.exe^^:
cd C:\Python27\Lib\site-packages\cxx2rs
C:\Python27\Lib\site-packages\cxx2rs> C:\Python27\python.exe C:\Python27\Lib\site-packages\cxx2rs__main__.py "C:\Program Files\Java\jdk1.7.0_79\include\jvmti.h" > jvmti.rs
Traceback (most recent call last):
File "C:\Python27\Lib\site-packages\cxx2rs__main__.py", line 13, in
could you try to change line 13 in __main__ to
from .parser import canonical_function_name
or also try
from cxx2rs.parser import canonical_function_name
(Windows is weird ;)
Can this problem be caused by python path is not set to PATH env. variable?
With this 'from cxx2rs.parser import canonical_function_name' I also have a error (clang is installed to 'C:\Python27\Lib\site-packages\clang')
Traceback (most recent call last):
File "C:\Python27\Lib\site-packages\cxx2rs__main__.py", line 88, in
This is at least one step further! ;) On linux I would set LD_LIBRARY_PATH to /usr/lib/llvm-3.5/lib. No clue how to do this on Windows.