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

UDFs don't work on ARM #335

Closed
aplavin opened this issue Sep 27, 2023 · 4 comments · Fixed by #336
Closed

UDFs don't work on ARM #335

aplavin opened this issue Sep 27, 2023 · 4 comments · Fixed by #336

Comments

@aplavin
Copy link
Contributor

aplavin commented Sep 27, 2023

On ARM processors, like Apple Silicon, registering an UDF throws with cfunction: closures are not supported on this platform:

julia> using SQLite
julia> db = SQLite.DB(":memory:")
julia> SQLite.register(db, exp, name="myfunc")
ERROR: cfunction: closures are not supported on this platform

This errors both before and after #333. As I understand, the issue is not in anonymous functions, but in closing over func here

SQLite.jl/src/UDF.jl

Lines 215 to 218 in dce0b6c

f =
(context, nargs, values) ->
wrap_scalarfunc(func, context, nargs, values)
cfunc = @cfunction($f, Cvoid, (Ptr{Cvoid}, Cint, Ptr{Ptr{Cvoid}}))

Do not know how to fix this exactly, but should be possible – given discussion at JuliaLang/julia#27174 and in linked issues.

@metab0t
Copy link
Collaborator

metab0t commented Sep 27, 2023

@aplavin Does #336 solve your problem?

@aplavin
Copy link
Contributor Author

aplavin commented Sep 27, 2023

Yes, UDFs work with that PR!
Thanks for a very prompt fix, I didn't know about such an approach to pass julia functions.

@aplavin
Copy link
Contributor Author

aplavin commented Sep 27, 2023

Can you actually release these recent fixes?

@metab0t
Copy link
Collaborator

metab0t commented Sep 27, 2023

@quinnj Can we release a new version to include recent fixes?

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

Successfully merging a pull request may close this issue.

2 participants