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

Calling dt-ffi/define-library-interface with a large interface throws "Method code too large!" exception. #115

Open
phronmophobic opened this issue Sep 24, 2024 · 0 comments

Comments

@phronmophobic
Copy link
Contributor

Trying to generate a large interface withdt-ffi/define-library-interface throws an Exception. I'm not sure what the approximate limit is.

The structs and interface can be found at https://gist.github.com/phronmophobic/ee367a0e846868b13be41e7e5af82d49.

Workaround:

Spitting up the interface into multiple calls and multiple classes seems to work:

(def dtype-interface (gen/api->library-interface api))
(defmacro chunk-define []
  `(do
     ~@(into
        []
        (comp (map-indexed
               (fn [i chunk]
                 (let [interface (into {} chunk)
                       classname (symbol (str (ns-name *ns* ) (str ".Bindings" i)))]
                   `(dt-ffi/define-library-interface (quote ~interface)
                      :classname (quote ~classname))))))
        (partition-all 5 dtype-interface))))

(chunk-define)

Macros and data FTW!

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

1 participant