Skip to content

Commit

Permalink
fixed #14
Browse files Browse the repository at this point in the history
  • Loading branch information
lausdahl committed Nov 4, 2020
1 parent eddf349 commit 733096b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ public DirectoryFmu(File path, String name) throws FmuInvocationException
this.dir = path;
this.name = name;

if (!NativeFmu.isNativeApiLoaded())
{
throw new FmuInvocationException("Native fmuapi library not loaded. Check log for more information.");
}
// if (!NativeFmu.isNativeApiLoaded())
// {
// throw new FmuInvocationException("Native fmuapi library not loaded. Check log for more information.");
// }

}

Expand Down Expand Up @@ -151,6 +151,7 @@ public void internalLoad(File libraryPath) throws FmuInvocationException, FmuMis
}

logger.debug("Loading FMU library: {}", libraryPath);
NativeFmu.loadNativeApi();
// load dll
synchronized (lock)
{
Expand Down
10 changes: 7 additions & 3 deletions jnifmuapi/src/main/java/org/intocps/fmi/jnifmuapi/NativeFmu.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,12 @@ interface ICallback

static private boolean isLoaded;

static
public static void loadNativeApi()
{
if(isLoaded)
{
return;
}
String libPath = NativeFmuApi.getPlatformSpecificLibaryPath("fmuapi");
logger.debug("Loading library: " + libPath);
File lib;
Expand All @@ -64,9 +68,9 @@ interface ICallback
isLoaded = true;
} catch (Exception e)
{
logger.error("Faild to load native Library file: " + libPath, e);
// throw new RuntimeException( "Unable to load native library fmuapi",e);
logger.error("Failed to load native Library file: " + libPath, e);
isLoaded = false;
throw new RuntimeException("Failed to load native Library file: " + libPath, e);
}

}
Expand Down

0 comments on commit 733096b

Please sign in to comment.