Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
GHC
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
4,324
Issues
4,324
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
360
Merge Requests
360
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Glasgow Haskell Compiler
GHC
Commits
9d708897
Commit
9d708897
authored
Oct 29, 2001
by
simonmar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[project @ 2001-10-29 12:21:57 by simonmar]
Add C++ extern "C" wrappers to generated stubs.
parent
f41ac4fd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
ghc/compiler/main/CodeOutput.lhs
ghc/compiler/main/CodeOutput.lhs
+9
-5
No files found.
ghc/compiler/main/CodeOutput.lhs
View file @
9d708897
...
...
@@ -188,7 +188,7 @@ outputForeignStubs dflags c_code h_code
stub_h_file_exists
<- outputForeignStubs_help (hscStubHOutName dflags) stub_h_output_w
"#include \"HsFFI.h\"\n"
("#include \"HsFFI.h\"\n" ++ cplusplus_hdr) cplusplus_ftr
dumpIfSet_dyn dflags Opt_D_dump_foreign
"Foreign export stubs" stub_c_output_d
...
...
@@ -199,7 +199,9 @@ outputForeignStubs dflags c_code h_code
<- outputForeignStubs_help (hscStubCOutName dflags) stub_c_output_w
("#define IN_STG_CODE 0\n" ++
hc_header ++
"#include \"RtsAPI.h\"\n")
"#include \"RtsAPI.h\"\n" ++
cplusplus_hdr)
cplusplus_ftr
-- we're adding the default hc_header to the stub file, but this
-- isn't really HC code, so we need to define IN_STG_CODE==0 to
-- avoid the register variables etc. being enabled.
...
...
@@ -214,13 +216,15 @@ outputForeignStubs dflags c_code h_code
stub_h_output_d = pprCode CStyle h_code
stub_h_output_w = showSDoc stub_h_output_d
cplusplus_hdr = "#ifdef __cplusplus\nextern \"C\" {\n#endif\n"
cplusplus_ftr = "#ifdef __cplusplus\n}\n#endif\n"
-- Don't use doOutput for dumping the f. export stubs
-- since it is more than likely that the stubs file will
-- turn out to be empty, in which case no file should be created.
outputForeignStubs_help fname ""
injects
= return False
outputForeignStubs_help fname doc_str
injects
= do writeFile fname (
injects ++ doc_st
r ++ "\n")
outputForeignStubs_help fname ""
header footer
= return False
outputForeignStubs_help fname doc_str
header footer
= do writeFile fname (
header ++ doc_str ++ '\n':foote
r ++ "\n")
return True
\end{code}
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