From 6a70b71e6e15e2e1b3cc8cdd45637757386ca40e Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@uliege.be>
Date: Tue, 15 Sep 2020 08:58:04 +0200
Subject: [PATCH] clearer

---
 api/GenApi.py | 6 ++++--
 api/gmsh.jl   | 3 ++-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/api/GenApi.py b/api/GenApi.py
index 94d4649a3f..409a15fc9a 100644
--- a/api/GenApi.py
+++ b/api/GenApi.py
@@ -758,8 +758,10 @@ def isizefun(name):
                     "            api_" + name + "_ = api_" + name +
                     "_type_(lambda dim, tag, x, y, z, _ : " + name + "(dim, tag, x, y, z))")
     a.python_arg = "api_" + name + "_, None"
-    a.julia_pre = ("api_" + name + "_ = @cfunction($" + name +
-                   ", Cdouble, (Cint, Cint, Cdouble, Cdouble, Cdouble))")
+    a.julia_pre = (
+        "api_" + name + "__(dim, tag, x, y, z, data) = " + name + "(dim, tag, x, y, z)\n    " +
+        "api_" + name + "_ = @cfunction($api_" + name + "__" +
+                   ", Cdouble, (Cint, Cint, Cdouble, Cdouble, Cdouble, Ptr{Cvoid}))")
     a.julia_arg = "api_" + name + "_, C_NULL"
     a.julia_ctype = "Ptr{Cvoid}, Ptr{Cvoid}"
     return a
diff --git a/api/gmsh.jl b/api/gmsh.jl
index 96148d4a82..f466696cfc 100644
--- a/api/gmsh.jl
+++ b/api/gmsh.jl
@@ -2205,7 +2205,8 @@ Set a global mesh size callback. The callback should take 5 arguments (`dim`,
 (`x`, `y`, `z`).
 """
 function setSizeCallback(callback)
-    api_callback_ = @cfunction($callback, Cdouble, (Cint, Cint, Cdouble, Cdouble, Cdouble))
+    api_callback__(dim, tag, x, y, z, data) = callback(dim, tag, x, y, z)
+    api_callback_ = @cfunction($api_callback__, Cdouble, (Cint, Cint, Cdouble, Cdouble, Cdouble, Ptr{Cvoid}))
     ierr = Ref{Cint}()
     ccall((:gmshModelMeshSetSizeCallback, gmsh.lib), Cvoid,
           (Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cint}),
-- 
GitLab