use of org.graalvm.nativeimage.c.function.CLibrary in project graal by oracle.
the class NativeImageGenerator method processNativeLibraryImports.
@SuppressWarnings("try")
private NativeLibraries processNativeLibraryImports(MetaAccessProvider metaAccess, AnalysisConstantReflectionProvider aConstantReflection, SnippetReflectionProvider snippetReflection) {
CAnnotationProcessorCache.initialize();
try (StopTimer t = new Timer("(cap)").start()) {
NativeLibraries nativeLibs = new NativeLibraries(aConstantReflection, metaAccess, snippetReflection, ConfigurationValues.getTarget());
for (Method method : loader.findAnnotatedMethods(CConstant.class)) {
nativeLibs.loadJavaMethod(metaAccess.lookupJavaMethod(method));
}
for (Class<?> clazz : loader.findAnnotatedClasses(CStruct.class)) {
nativeLibs.loadJavaType(metaAccess.lookupJavaType(clazz));
}
for (Class<?> clazz : loader.findAnnotatedClasses(RawStructure.class)) {
nativeLibs.loadJavaType(metaAccess.lookupJavaType(clazz));
}
for (Class<?> clazz : loader.findAnnotatedClasses(CPointerTo.class)) {
nativeLibs.loadJavaType(metaAccess.lookupJavaType(clazz));
}
for (Class<?> clazz : loader.findAnnotatedClasses(CEnum.class)) {
nativeLibs.loadJavaType(metaAccess.lookupJavaType(clazz));
}
for (CLibrary library : loader.findAnnotations(CLibrary.class)) {
nativeLibs.addLibrary(library.value());
}
nativeLibs.finish(tempDirectory());
nativeLibs.reportErrors();
return nativeLibs;
}
}
Aggregations