我试图从Java调用dll函数,但总是收到此错误代码“ java.lang.UnsatisfiedLinkError:查找函数'DBSetting'时出错:找不到指定的过程。”。 试图使用JNA从Java调用dll文件。 Java文件:
public interface test extends Library{
test mathFuncs = (test)Native.loadLibrary("BCE.Utils", test.class);
DBSetting1 DBSetting(int dbServerType , String serverName, String userId, String password, String dbName);
}
具有(命名空间BCE.Data)的dll文件
public sealed class DBSetting : IDisposable
{
public DBSetting(DBServerType serverType, string connectionString);
public DBSetting(DBServerType serverType, string serverName, string dbName);
public DBSetting(DBServerType serverType, string serverName, string dbName, bool usePool);
public DBSetting(DBServerType serverType, string serverName, string userId, string password, string dbName);
public DBSetting(DBServerType serverType, string serverName, string userId, string password, string dbName, bool usePool);
public string ServerName { get; }
public string DBName { get; }
public string ConnectionString { get; }
public int CommandTimeOut { get; set; }
public bool StoredProcedure { get; set; }
public string PrivateDataPath { get; }
public DBServerType ServerType { get; }
public string PrivateCachingDataPath { get; }
public string PrivateCriteriaDataPath { get; }
[Obsolete("You should not access to Connection object to associate it to a SqlCommand. Instead, you better use CreateCommand to create your own SqlCommand.")]
public SqlConnection Connection { get; }
public int TransactionLevel { get; }
[Obsolete("You should not access to Transaction object to associate it to a SqlCommand. Instead, you better use CreateCommand to create your own SqlCommand.")]
public SqlTransaction Transaction { get; }
public event BeforeOpenConnectionEventHandler BeforeOpenConnectionEvent;
public static DBSetting CreateAutoCountDefaultDBSetting(string serverName, string dbName);
[Obsolete("You should use StartTransaction instead.")]
public SqlTransaction BeginTransaction();
[Obsolete("You should change to StartTransaction to make the coding simple yet elegant.")]
public DBSetting BeginTransaction(bool alwaysUseTransaction, out SqlConnection conn, out SqlTransaction tran);
public void Commit();
public DBSetting Copy();
[Obsolete("You should use StartTransaction instead. CopyForTransaction method will be removed in the future.")]
public DBSetting CopyForTransaction();
public DBSetting CopyWithNewDBName(string newDBName);
public SqlCommand CreateCommand();
public SqlCommand CreateCommand(string cmdText, params object[] parameters);
public void Dispose();
public void EndTransaction();
public int ExecuteNonQuery(string cmdText, params object[] parameters);
public object ExecuteScalar(string cmdText, params object[] parameters);
public DataTable GetDataTable(string cmdText, bool loadSchema, params object[] parameters);
public DataRow GetFirstDataRow(string cmdText, params object[] parameters);
public DataTable GetSchema(string selectCmdText);
public DateTime GetServerTime();
public int LoadDataSet(DataSet ds, string tableName, string cmdText, bool loadSchema, params object[] parameters);
public int LoadDataTable(DataTable table, string cmdText, bool loadSchema, params object[] parameters);
public void LoadSchema(DataTable table, string selectCmdText);
public void LoadSchema(DataSet ds, string tableName, string selectCmdText);
public void Rollback();
public int SimpleSaveDataSet(DataSet ds, string tableName, string selectCmdText, bool returnIdentityColumnValue);
public int SimpleSaveDataSet(DataSet ds, string tableName, string selectCmdText);
public int SimpleSaveDataTable(DataTable table, string selectCmdText, bool returnIdentityColumnValue);
public int SimpleSaveDataTable(DataTable table, string selectCmdText);
public DBSetting StartTransaction(int commandTimeout);
public DBSetting StartTransaction();
public void ThrowServerTypeNotSupportedException();
}
//Error will show after >> this line.
DBSetting mathFuncs = DBSetting.mathFuncs;
>>DBSetting1 myDb = (DBSetting1) mathFuncs.DBSetting(DBServerType.Firebird, "", "", "", "");