File tree Expand file tree Collapse file tree 2 files changed +15
-15
lines changed
Samples/SwiftKitSampleApp/src/main/java/com/example/swift Expand file tree Collapse file tree 2 files changed +15
-15
lines changed Original file line number Diff line number Diff line change @@ -32,20 +32,6 @@ public static void main(String[] args) {
32
32
boolean traceDowncalls = Boolean .getBoolean ("jextract.trace.downcalls" );
33
33
System .out .println ("Property: jextract.trace.downcalls = " + traceDowncalls );
34
34
35
- final var dylibNames = List .of (
36
- "swiftCore" ,
37
- "ExampleSwiftLibrary"
38
- );
39
-
40
-
41
- System .out .println ("Loading libraries..." );
42
-
43
- for (var lib : dylibNames ) {
44
- System .out .printf ("Loading: %s... " , lib );
45
- System .loadLibrary (lib );
46
- System .out .println ("ok." );
47
- }
48
-
49
35
examples ();
50
36
}
51
37
Original file line number Diff line number Diff line change @@ -100,6 +100,9 @@ extension Swift2JavaTranslator {
100
100
printImports ( & printer)
101
101
102
102
printModuleClass ( & printer) { printer in
103
+
104
+ printStaticLibraryLoad ( & printer)
105
+
103
106
// TODO: print all "static" methods
104
107
for decl in importedGlobalFuncs {
105
108
printFunctionDowncallMethods ( & printer, decl)
@@ -266,7 +269,7 @@ extension Swift2JavaTranslator {
266
269
private func printClassConstants( printer: inout CodePrinter ) {
267
270
printer. print (
268
271
"""
269
- static final String DYLIB_NAME = " \( swiftModuleName) " ;
272
+ static final String LIB_NAME = " \( swiftModuleName) " ;
270
273
static final Arena LIBRARY_ARENA = Arena.ofAuto();
271
274
"""
272
275
)
@@ -458,6 +461,17 @@ extension Swift2JavaTranslator {
458
461
)
459
462
}
460
463
464
+ public func printStaticLibraryLoad( _ printer: inout CodePrinter ) {
465
+ printer. print (
466
+ """
467
+ static {
468
+ System.loadLibrary( " swiftCore " );
469
+ System.loadLibrary(LIB_NAME);
470
+ }
471
+ """
472
+ )
473
+ }
474
+
461
475
public func printFunctionDowncallMethods( _ printer: inout CodePrinter , _ decl: ImportedFunc ) {
462
476
printer. printSeparator ( decl. identifier)
463
477
You can’t perform that action at this time.
0 commit comments