⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 nativelibrary.c

📁 kaffe Java 解释器语言,源码,Java的子集系统,开放源代码
💻 C
字号:
/* * java.lang.NativeLibrary.c * * Copyright (c) 2000 *	Archie L. Cobbs.  All rights reserved. * Copyright (c) 2000 *	Transvirtual Technologies, Inc.  All rights reserved. * * See the file "license.terms" for information on usage and redistribution  * of this file.  */#include "config.h"#include "config-std.h"#include "config-io.h"#include "config-mem.h"#include "defs.h"#include "../../../kaffe/kaffevm/gtypes.h"#include "../../../kaffe/kaffevm/object.h"#include "../../../kaffe/kaffevm/constants.h"#include "../../../kaffe/kaffevm/support.h"#include "../../../kaffe/kaffevm/external.h"#include "java_lang_String.h"#include "java_lang_NativeLibrary.h"#include <native.h>#ifndef LIBRARYPREFIX#define	LIBRARYPREFIX	"lib"#endif#ifndef LIBRARYSUFFIX#define LIBRARYSUFFIX	""#endif/* * Return prefix to prepend to library names */struct Hjava_lang_String*java_lang_NativeLibrary_getLibPrefix(){	return checkPtr(stringC2Java(LIBRARYPREFIX));}/* * Return suffix to append to library names */struct Hjava_lang_String*java_lang_NativeLibrary_getLibSuffix(){	return checkPtr(stringC2Java(LIBRARYSUFFIX));}/* * Attempt to link in a shared library. Throws an UnsatisfiedLinkError * if the attempt fails. */intjava_lang_NativeLibrary_linkLibrary(struct Hjava_lang_String *jpath){	char path[MAXPATHLEN];	char errbuf[128];	errorInfo einfo;	int index = -1;	stringJava2CBuf(jpath, path, sizeof(path));	if ((index = loadNativeLibrary(path, errbuf, sizeof(errbuf))) < 0) { 		if( strstr(errbuf, "ile not found") ) { 			postExceptionMessage(&einfo, 					     JAVA_IO(FileNotFoundException), 					     "%s", 					     path); 		} else {			postExceptionMessage(&einfo, 					     JAVA_LANG(UnsatisfiedLinkError),					     "%s",					     errbuf);			throwError(&einfo);		}	} 	if( index == -1 ) 		throwError(&einfo);	return index;}/* * Unlink a shared library. */voidjava_lang_NativeLibrary_unlinkLibrary(int index){	unloadNativeLibrary(index);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -