Skip to content

Commit ff9269e

Browse files
committed
Adding weak attribute to weak-node-api symbols
1 parent 714adad commit ff9269e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/weak-node-api/scripts/generate-weak-node-api.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export function generateHeader(functions: FunctionDecl[]) {
2424
({ returnType, noReturn, name, argumentTypes }) =>
2525
`${returnType} ${
2626
noReturn ? " __attribute__((noreturn))" : ""
27-
}(*${name})(${argumentTypes.join(", ")});`,
27+
} (*${name})(${argumentTypes.join(", ")});`,
2828
),
2929
"};",
3030
"typedef void(*InjectHostFunction)(const WeakNodeApiHost&);",
@@ -50,7 +50,7 @@ export function generateSource(functions: FunctionDecl[]) {
5050
return [
5151
`extern "C" ${returnType} ${
5252
noReturn ? " __attribute__((noreturn))" : ""
53-
}${name}(${argumentTypes
53+
} __attribute__((weak)) ${name}(${argumentTypes
5454
.map((type, index) => `${type} arg${index}`)
5555
.join(", ")}) {`,
5656
`if (g_host.${name} == nullptr) {`,

0 commit comments

Comments
 (0)