Commit f96286b3 authored by Lisandro Dalcin's avatar Lisandro Dalcin

More work on pxd/public/api import/export

parent 0c2cc2a2
...@@ -1006,6 +1006,8 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -1006,6 +1006,8 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
type = entry.type type = entry.type
if not definition and entry.defined_in_pxd: if not definition and entry.defined_in_pxd:
storage_class = "static "
dll_linkage = None
type = CPtrType(type) type = CPtrType(type)
header = type.declaration_code(entry.cname, header = type.declaration_code(entry.cname,
dll_linkage = dll_linkage) dll_linkage = dll_linkage)
......
...@@ -582,7 +582,8 @@ class Scope(object): ...@@ -582,7 +582,8 @@ class Scope(object):
api = 0, in_pxd = 0, modifiers = (), utility_code = None): api = 0, in_pxd = 0, modifiers = (), utility_code = None):
# Add an entry for a C function. # Add an entry for a C function.
if not cname: if not cname:
if api or visibility != 'private': if (visibility == 'extern' or
visibility == 'public'and defining):
cname = name cname = name
else: else:
cname = self.mangle(Naming.func_prefix, name) cname = self.mangle(Naming.func_prefix, name)
...@@ -612,6 +613,8 @@ class Scope(object): ...@@ -612,6 +613,8 @@ class Scope(object):
entry.type = type entry.type = type
else: else:
error(pos, "Function signature does not match previous declaration") error(pos, "Function signature does not match previous declaration")
entry.cname = cname
entry.func_cname = cname
else: else:
entry = self.add_cfunction(name, type, pos, cname, visibility, modifiers) entry = self.add_cfunction(name, type, pos, cname, visibility, modifiers)
entry.func_cname = cname entry.func_cname = cname
......
# mode: compile
from publicapi_pxd_mix cimport *
...@@ -49,12 +49,17 @@ cdef public api class Bar3 [type PyBar3_Type, object PyBar3_Object]: pass ...@@ -49,12 +49,17 @@ cdef public api class Bar3 [type PyBar3_Type, object PyBar3_Object]: pass
# -- # --
cdef inline void bar0(): pass cdef extern from *:
void foo()
cdef inline void bar (): pass
cdef void bar0()
cdef public void bar1() cdef public void bar1()
cdef api void bar2() cdef api void bar2()
cdef public api void bar3() cdef public api void bar3()
cdef inline void* spam0(object o) except NULL: return NULL cdef inline void* spam (object o) except NULL: return NULL
cdef void* spam0(object o) except NULL
cdef public void* spam1(object o) except NULL cdef public void* spam1(object o) except NULL
cdef api void* spam2(object o) nogil except NULL cdef api void* spam2(object o) nogil except NULL
cdef public api void* spam3(object o) except NULL with gil cdef public api void* spam3(object o) except NULL with gil
......
...@@ -8,10 +8,12 @@ cdef class Bar1: pass ...@@ -8,10 +8,12 @@ cdef class Bar1: pass
cdef class Bar2: pass cdef class Bar2: pass
cdef class Bar3: pass cdef class Bar3: pass
cdef void bar0(): pass
cdef public void bar1(): pass cdef public void bar1(): pass
cdef api void bar2(): pass cdef api void bar2(): pass
cdef public api void bar3(): pass cdef public api void bar3(): pass
cdef void* spam0(object o) except NULL: return NULL
cdef public void* spam1(object o) except NULL: return NULL cdef public void* spam1(object o) except NULL: return NULL
cdef api void* spam2(object o) nogil except NULL: return NULL cdef api void* spam2(object o) nogil except NULL: return NULL
cdef public api void* spam3(object o) except NULL with gil: return NULL cdef public api void* spam3(object o) except NULL with gil: return NULL
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment