aboutsummaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-06-13 21:20:50 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-06-13 21:20:50 -0400
commit81d55cacb7b86add20613510b8fa9da74e58bdca (patch)
tree0051267dda1a43265251bb6e0d36ebd26022bef5 /compile.c
parentdab2c399f1b574b598c908124acebaa06c80938a (diff)
Do dynamic library symbol prefixing using 'patchelf'
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/compile.c b/compile.c
index a33a5f1e..324fdef3 100644
--- a/compile.c
+++ b/compile.c
@@ -16,7 +16,6 @@
static CORD compile_to_pointer_depth(env_t *env, ast_t *ast, int64_t target_depth, bool allow_optional);
static env_t *with_enum_scope(env_t *env, type_t *t);
-static CORD compile_statement_header(env_t *env, ast_t *ast);
CORD compile_type_ast(env_t *env, type_ast_t *t)
{
@@ -2276,10 +2275,9 @@ CORD compile_statement_header(env_t *env, ast_t *ast)
}
case FunctionDef: {
auto fndef = Match(ast, FunctionDef);
- bool is_private = Match(fndef->name, Var)->name[0] == '_';
+ const char *decl_name = Match(fndef->name, Var)->name;
+ bool is_private = decl_name[0] == '_';
if (is_private) return CORD_EMPTY;
- CORD name = compile(env, fndef->name);
-
CORD arg_signature = "(";
for (arg_ast_t *arg = fndef->args; arg; arg = arg->next) {
type_t *arg_type = get_arg_ast_type(env, arg);
@@ -2290,7 +2288,7 @@ CORD compile_statement_header(env_t *env, ast_t *ast)
type_t *ret_t = fndef->ret_type ? parse_type_ast(env, fndef->ret_type) : Type(VoidType);
CORD ret_type_code = compile_type(env, ret_t);
- CORD header = CORD_all(ret_type_code, " ", name, arg_signature, ";\n");
+ CORD header = CORD_all(ret_type_code, " ", CORD_cat(env->file_prefix, decl_name), arg_signature, ";\n");
return header;
}
case Lambda: {