IIRC we support inline functions, if the C parser (which is mostly complete, even though targeted at .h files and not implementations) can handle them, and they would be represented in the .fx as syntax tree (much as they wudkl if you yourself define an inline function and build the project to a library+fx…
This is great to know that Island has C Parser. On TensorFlow official website, this new C API change (of directly using C inline functions) causes quite big headache for .NET and Rust bindings. I guess that is the reason why we should use Island!
That being said, I tried to import the latest TensorFlow 2.4, but wasn’t very successful. Could you help me take a look? Import-tf-240.zip (39.9 KB)
Two things to NOTE:
They reference standard C header files like stdlib.h etc. I am not 100% sure how to handle that.
The inline functions have MACROS like below, for different platforms (Windows, MacOS, Linux), again, I am not sure how to handle that:
Extracting '/Users/mh/Library/Application Support/RemObjects Software/EBuild/Remotes/27964E082C18C507E05AE4DD3633437580963978/libtensorflow-cpu-darwin-x86_64-2.4.0.tar.gz'
W: File '/Users/mh/Library/Application Support/RemObjects Software/EBuild/Remotes/27964E082C18C507E05AE4DD3633437580963978/z/lib/libtensorflow_framework.2.3.0.dylib' was not found in downloaded archive.
E: Import file '/Users/mh/Library/Application Support/RemObjects Software/EBuild/Remotes/27964E082C18C507E05AE4DD3633437580963978/z/lib/libtensorflow_framework.2.3.0.dylib' does not exist.
the other two platforms are ok, so i’ll just disable macOS for now…
So I added the above macros to import.h, and it seems working, and the importer no longer complains endianness. But, now the importer complains that "Cannot find include file: stdlib.h [C:\DEVLIBS\RO\Element\TensorFlow-Island\Island\Projects\Import\include\tensorflow\core\platform\ctstring.h (20)]
stdlib.h is standard C header files, located at C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt
Is there a way to add this include to search path of the importer?
You can but is there actually something in there it needs? Sometimes they just get over excited in adding includes. If you add an empty stdlib.h next to the files, does it work then?
This seems to suggest that Island C Parser has some problem parsing the value of SIZE_MAX0xffffffffffffffffui64 as 64bit unsigned integer literal. SIZE_MAX is defined in both limits.h and stdint.h
It is not in many places. Just referenced in one single file.
But it is “compiled” in Island rtl file (as part of the C run time). I guess I can override it somewhere as a workaround. But I’d like to wait for the more graceful importer solution with an enhanced C parser.