fix(0130): #library/#framework collection recurses into nested namespaces
extractLibraries/extractFrameworks walked the merged root plus exactly one namespace_decl level, so a #library reached through two or more aliased imports never made it to the AOT link line or the JIT dlopen list. Both walks now recurse over namespace_decl children. Regression: examples/1617-modules-library-nested-namespace.sx binds libpcap (not in the compiler's loaded images, so the JIT cannot mask the miss via RTLD_DEFAULT) behind two aliased imports.
This commit is contained in:
10
examples/1617-modules-library-nested-namespace.sx
Normal file
10
examples/1617-modules-library-nested-namespace.sx
Normal file
@@ -0,0 +1,10 @@
|
||||
// Regression (issue 0130): a #library declared in a module reached through
|
||||
// TWO aliased imports must still be linked (AOT) / dlopened (JIT).
|
||||
#import "modules/std.sx";
|
||||
b :: #import "1617-modules-library-nested-namespace/b.sx";
|
||||
|
||||
main :: () -> i32 {
|
||||
v := b.version_via_b();
|
||||
print("pcap version non-empty: {}\n", v.len > 0);
|
||||
return 0;
|
||||
}
|
||||
5
examples/1617-modules-library-nested-namespace/b.sx
Normal file
5
examples/1617-modules-library-nested-namespace/b.sx
Normal file
@@ -0,0 +1,5 @@
|
||||
// Middle module: aliases c.sx, putting its #library one namespace deep.
|
||||
#import "modules/std.sx";
|
||||
c :: #import "c.sx";
|
||||
|
||||
version_via_b :: () -> string { return c.pcap_version(); }
|
||||
11
examples/1617-modules-library-nested-namespace/c.sx
Normal file
11
examples/1617-modules-library-nested-namespace/c.sx
Normal file
@@ -0,0 +1,11 @@
|
||||
// Innermost module: owns the #library and its foreign fn.
|
||||
#import "modules/std.sx";
|
||||
|
||||
pcaplib :: #library "pcap";
|
||||
pcap_lib_version :: () -> ?cstring #foreign pcaplib "pcap_lib_version";
|
||||
|
||||
pcap_version :: () -> string {
|
||||
p := pcap_lib_version();
|
||||
if p == null { return ""; }
|
||||
return from_cstring(p!);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
0
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
pcap version non-empty: true
|
||||
Reference in New Issue
Block a user