diff --git a/hysop/backend/device/codegen/base/variables.py b/hysop/backend/device/codegen/base/variables.py
index d460e17a78f5f3bdc0a0f07b9a6ef2b5990c1613..4fc29cbdbdbe0dccd2295d1cc639e2e378fbe1e5 100644
--- a/hysop/backend/device/codegen/base/variables.py
+++ b/hysop/backend/device/codegen/base/variables.py
@@ -111,7 +111,7 @@ def register_ctype_dtype(ctype,dtype):
 class CodegenVariable:
 
     def __init__(self, name, ctype, typegen,
-            storage=None, const=False, volatile=False,
+            storage=None, const=False, volatile=False, static=False,
             add_impl_const=False, nl=None, align=None,
             ptr=False, ptr_restrict=None, ptr_volatile=None, ptr_const=None,
             value=None, svalue=None, init=None,
@@ -140,6 +140,7 @@ class CodegenVariable:
         self.add_impl_const = add_impl_const
         self.storage = storage
         self.align = align
+        self.static = static
         self.declared = False
 
         self.nl = nl if (nl is not None) else (storage is not None)
@@ -306,19 +307,25 @@ class CodegenVariable:
     def base_ctype(self, storage=None, ctype=None,
             const=None, volatile=None,
             impl=True, align=None,
-            add_impl_const=None):
+            add_impl_const=None, static=None):
+
         align = first_not_None(align, self.align, False)
         storage  = self.storage  if (storage is None)  else storage
         ctype    = self.ctype    if (ctype is None)    else ctype
         volatile = self.volatile if (volatile is None) else volatile
+        static   = self.static if (static is None) else static
+
+        static |= (storage is not None) and ('__constant' in storage)
 
         if (const is None):
             const = self.const
             if impl and (not self.is_ptr) and (not const):
                 const = self.add_impl_const if (add_impl_const is None) else add_impl_const
+        const |= (storage is not None) and ('__constant' in storage)
 
-        base_ctype = '{storage}${const}${volatile}${ctype}'.format(
+        base_ctype = '{storage}${static}${const}${volatile}${ctype}'.format(
                 storage=f'{storage} ' if (storage is not None) else '',
+                static='static ' if static else '',
                 const='const ' if const else '',
                 volatile='volatile ' if volatile else '',
                 ctype=ctype+' ')
@@ -346,13 +353,13 @@ class CodegenVariable:
 
     def full_ctype(self, storage=None, ctype=None, const=None, volatile=None,
             impl=True, multidecl=False, align=None, cast=False,
-            add_impl_const=None):
+            add_impl_const=None, **kwds):
         align = first_not_None(align, self.align, False)
         if multidecl:
             base_ctype = ''
         else:
             base_ctype = self.base_ctype(storage,ctype,const,volatile,impl,align,
-                    add_impl_const=add_impl_const)
+                    add_impl_const=add_impl_const, **kwds)
             if len(base_ctype)==0:
                 msg= f'Failed to get base ctype in {self.__class__}.'
                 raise RuntimeError(msg)
@@ -421,11 +428,11 @@ class CodegenVariable:
 
     def declare(self, codegen=None, align=None,
             multidecl=False, const=None, _const=None, init=None,
-            compact=False):
+            compact=False, **kwds):
         # const means add_impl_const, ie. declare current variable as constant (not pointed types)
         # _const is the real const
         align = first_not_None(align, self.align, False)
-        ctype = self.full_ctype(align=align,multidecl=multidecl,add_impl_const=const, const=_const)
+        ctype = self.full_ctype(align=align,multidecl=multidecl,add_impl_const=const, const=_const, **kwds)
         if (not multidecl) and len(ctype)==0:
             msg= f'Failed to get full ctype in {self.__class__}.'
             raise RuntimeError(msg)
@@ -1053,7 +1060,7 @@ if __name__ == '__main__':
     tg = test_typegen('float')
 
     print(':: ARRAYS ::')
-    var = CodegenArray(name='A0',ctype='float',dim=3,
+    var = CodegenArray(name='A0',ctype='float',dim=3, storage='__constant',
             value=[[
                     [1,2,3],
                     [4,5,6],
@@ -1112,7 +1119,7 @@ if __name__ == '__main__':
     for i in range(var.dim):
         print(var[i])
     print(var[1:3])
-    print(var.declare())
+    print(var.declare(storage='__constant'))
     print()
 
     # hexadecimal deciml float dumper
diff --git a/hysop/backend/device/opencl/operator/custom.py b/hysop/backend/device/opencl/operator/custom.py
index 340698f40cafbb1dc0219514e8fefff770fa93c5..f60954d25579e54c7ad5270f032eebfd02dacab8 100644
--- a/hysop/backend/device/opencl/operator/custom.py
+++ b/hysop/backend/device/opencl/operator/custom.py
@@ -53,9 +53,9 @@ class OpenClCustomOperator(CustomOperatorBase, OpenClOperator):
                                          mbs_typedef=mbs.typedef, vsize=dim))
         for f in self.discrete_fields:
             fn = f.continuous_fields()[0].name
-            mesh_info = MeshInfoStruct.create_from_mesh(fn+"_mesh", self.typegen, f.mesh,
+            struct_value, struct_variable = MeshInfoStruct.create_from_mesh(fn+"_mesh", self.typegen, f.mesh,
                                                         storage=OpenClCodeGenerator.default_keywords['constant'])
-            mesh_info[1].declare(cg, _const=True)
+            struct_variable.declare(cg)
             cg.append(f"""int3 get_{fn}i_xyz(int i) {{
               int iz = i/({fn}_mesh.local_mesh.resolution.x*{fn}_mesh.local_mesh.resolution.y);
               int iy = (i-({fn}_mesh.local_mesh.resolution.x*{fn}_mesh.local_mesh.resolution.y)*iz)/({fn}_mesh.local_mesh.resolution.x);
diff --git a/hysop/numerics/fft/gpyfft_fft.py b/hysop/numerics/fft/gpyfft_fft.py
index 682940f14cf5c7865fd708644f7ca4b49a07aba2..fb2bc182498c04de8a8434ce9808444a19a83c6c 100644
--- a/hysop/numerics/fft/gpyfft_fft.py
+++ b/hysop/numerics/fft/gpyfft_fft.py
@@ -894,7 +894,7 @@ Post callback source code:
                 typegen.dump(x.real), typegen.dump(x.imag), fp=fp) for x in E)
             twiddles = \
                 '''
-            __constant const {fp}2 {name}[{N}] = {{
+            __constant static const {fp}2 {name}[{N}] = {{
     {vals}
             }};
             '''.format(fp=fp, name=name, vals=vals, N=count)