Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
c9765a85
Commit
c9765a85
authored
Jun 11, 2011
by
Lisandro Dalcin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix public variable/function to use extern "C" name mangling
parent
78c21508
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
11 deletions
+22
-11
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+22
-11
No files found.
Cython/Compiler/ModuleNode.py
View file @
c9765a85
...
@@ -296,7 +296,8 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
...
@@ -296,7 +296,8 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
self
.
generate_cached_builtins_decls
(
env
,
code
)
self
.
generate_cached_builtins_decls
(
env
,
code
)
self
.
generate_lambda_definitions
(
env
,
code
)
self
.
generate_lambda_definitions
(
env
,
code
)
# generate normal function definitions
# generate normal variable and function definitions
self
.
generate_variable_definitions
(
env
,
code
)
self
.
body
.
generate_function_definitions
(
env
,
code
)
self
.
body
.
generate_function_definitions
(
env
,
code
)
code
.
mark_pos
(
None
)
code
.
mark_pos
(
None
)
self
.
generate_typeobj_definitions
(
env
,
code
)
self
.
generate_typeobj_definitions
(
env
,
code
)
...
@@ -993,7 +994,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
...
@@ -993,7 +994,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
if
(
entry
.
in_cinclude
or
entry
.
in_closure
or
if
(
entry
.
in_cinclude
or
entry
.
in_closure
or
(
entry
.
visibility
==
'private'
and
(
entry
.
visibility
==
'private'
and
not
(
entry
.
defined_in_pxd
or
entry
.
used
))):
not
(
entry
.
defined_in_pxd
or
entry
.
used
))):
continue
continue
storage_class
=
None
storage_class
=
None
dll_linkage
=
None
dll_linkage
=
None
...
@@ -1004,25 +1005,25 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
...
@@ -1004,25 +1005,25 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
storage_class
=
Naming
.
extern_c_macro
storage_class
=
Naming
.
extern_c_macro
dll_linkage
=
"DL_IMPORT"
dll_linkage
=
"DL_IMPORT"
elif
entry
.
visibility
==
'public'
:
elif
entry
.
visibility
==
'public'
:
storage_class
=
Naming
.
extern_c_macro
if
definition
:
if
definition
:
dll_linkage
=
"DL_EXPORT"
dll_linkage
=
"DL_EXPORT"
else
:
else
:
storage_class
=
Naming
.
extern_c_macro
dll_linkage
=
"DL_IMPORT"
dll_linkage
=
"DL_IMPORT"
elif
entry
.
visibility
==
'private'
:
elif
entry
.
visibility
==
'private'
:
storage_class
=
"static"
storage_class
=
"static"
dll_linkage
=
None
if
entry
.
init
is
not
None
:
init
=
entry
.
type
.
literal_code
(
entry
.
init
)
type
=
entry
.
type
cname
=
entry
.
cname
if
entry
.
defined_in_pxd
and
not
definition
:
if
entry
.
defined_in_pxd
and
not
definition
:
type
=
CPtrType
(
entry
.
type
)
storage_class
=
"static"
storage_class
=
"static"
dll_linkage
=
None
dll_linkage
=
None
type
=
CPtrType
(
type
)
cname
=
env
.
mangle
(
Naming
.
varptr_prefix
,
entry
.
name
)
cname
=
env
.
mangle
(
Naming
.
varptr_prefix
,
entry
.
name
)
init
=
0
init
=
0
else
:
type
=
entry
.
type
cname
=
entry
.
cname
if
entry
.
init
is
not
None
:
init
=
type
.
literal_code
(
entry
.
init
)
if
storage_class
:
if
storage_class
:
code
.
put
(
"%s "
%
storage_class
)
code
.
put
(
"%s "
%
storage_class
)
...
@@ -1042,7 +1043,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
...
@@ -1042,7 +1043,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
storage_class
=
"%s "
%
Naming
.
extern_c_macro
storage_class
=
"%s "
%
Naming
.
extern_c_macro
dll_linkage
=
"DL_IMPORT"
dll_linkage
=
"DL_IMPORT"
elif
entry
.
visibility
==
'public'
:
elif
entry
.
visibility
==
'public'
:
storage_class
=
"
"
storage_class
=
"
%s "
%
Naming
.
extern_c_macro
dll_linkage
=
"DL_EXPORT"
dll_linkage
=
"DL_EXPORT"
elif
entry
.
visibility
==
'private'
:
elif
entry
.
visibility
==
'private'
:
storage_class
=
"static "
storage_class
=
"static "
...
@@ -1052,7 +1053,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
...
@@ -1052,7 +1053,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
dll_linkage
=
None
dll_linkage
=
None
type
=
entry
.
type
type
=
entry
.
type
if
not
definition
and
entry
.
defined_in_pxd
:
if
entry
.
defined_in_pxd
and
not
definition
:
storage_class
=
"static "
storage_class
=
"static "
dll_linkage
=
None
dll_linkage
=
None
type
=
CPtrType
(
type
)
type
=
CPtrType
(
type
)
...
@@ -1068,6 +1069,16 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
...
@@ -1068,6 +1069,16 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
modifiers
,
modifiers
,
header
))
header
))
def
generate_variable_definitions
(
self
,
env
,
code
):
for
entry
in
env
.
var_entries
:
if
(
not
entry
.
in_cinclude
and
entry
.
visibility
==
"public"
):
code
.
put
(
entry
.
type
.
declaration_code
(
entry
.
cname
))
if
entry
.
init
is
not
None
:
init
=
entry
.
type
.
literal_code
(
entry
.
init
)
code
.
put_safe
(
" = %s"
%
init
)
code
.
putln
(
";"
)
def
generate_typeobj_definitions
(
self
,
env
,
code
):
def
generate_typeobj_definitions
(
self
,
env
,
code
):
full_module_name
=
env
.
qualified_name
full_module_name
=
env
.
qualified_name
for
entry
in
env
.
c_class_entries
:
for
entry
in
env
.
c_class_entries
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment