mirror of
https://github.com/ziglang/zig.git
synced 2025-12-09 15:53:08 +00:00
cbe: handle underscore prexfix on macos, don't mangle extern function names
This commit is contained in:
parent
192e9a315d
commit
26dabbf301
@ -203,7 +203,11 @@ typedef char bool;
|
|||||||
__pragma(comment(linker, "/alternatename:_" #symbol "=_" #name ))
|
__pragma(comment(linker, "/alternatename:_" #symbol "=_" #name ))
|
||||||
#endif /*_M_X64 */
|
#endif /*_M_X64 */
|
||||||
#else
|
#else
|
||||||
|
#if __APPLE__
|
||||||
|
#define zig_import(sig, symbol, name) zig_extern sig __asm("_" #name);
|
||||||
|
#else /* __APPLE__ */
|
||||||
#define zig_import(sig, symbol, name) zig_extern sig __asm(#name);
|
#define zig_import(sig, symbol, name) zig_extern sig __asm(#name);
|
||||||
|
#endif /* __APPLE__ */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define zig_expand_import(sig, symbol, name) zig_import(sig, symbol, name)
|
#define zig_expand_import(sig, symbol, name) zig_import(sig, symbol, name)
|
||||||
|
|||||||
@ -1978,7 +1978,7 @@ pub const DeclGen = struct {
|
|||||||
if (mod.decl_exports.get(decl_index)) |exports| {
|
if (mod.decl_exports.get(decl_index)) |exports| {
|
||||||
try writer.print("{ }", .{fmtIdent(mod.intern_pool.stringToSlice(exports.items[export_index].opts.name))});
|
try writer.print("{ }", .{fmtIdent(mod.intern_pool.stringToSlice(exports.items[export_index].opts.name))});
|
||||||
} else if (decl.getExternDecl(mod).unwrap()) |extern_decl_index| {
|
} else if (decl.getExternDecl(mod).unwrap()) |extern_decl_index| {
|
||||||
try writer.print("{ }", .{fmtIdent(mod.intern_pool.stringToSlice(mod.declPtr(extern_decl_index).name))});
|
try writer.print("{}", .{mod.declPtr(extern_decl_index).name.fmt(&mod.intern_pool)});
|
||||||
} else {
|
} else {
|
||||||
// MSVC has a limit of 4095 character token length limit, and fmtIdent can (worst case),
|
// MSVC has a limit of 4095 character token length limit, and fmtIdent can (worst case),
|
||||||
// expand to 3x the length of its input, but let's cut it off at a much shorter limit.
|
// expand to 3x the length of its input, but let's cut it off at a much shorter limit.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user