when importing through HDF5 interface, loading plug-in is failed
The script used is as follows:
loadPlugin("plugins/hdf5/PluginHdf5.txt")
The prompt is: Can't find module
On windows, the imported plug-ins needs to be specified with full path. You can use the following scripts for loading:
loadPlugin(getHomeDir()+"/plugins/hdf5/PluginHDF5.txt")
Besides, loadPlugin needs to be executed independently.
For the commonly used plug-ins, it is recommended to pre-load them by adding configuration item "preloadModules".
preloadModules=plugins::mysql,plugins::mqtt
In this way you can use them directly after the node is started.
Related
I'm writing a dart package in which I require the path to a file within the package to access the file for the package to work. The package is not written for the web platform.
My understanding of where packages are stored is limited, however, I would assume that there won't be a common directory for each platform, and even within platforms, I suppose it would vary based on how dart was installed on the specific machine.
Despite this being rather obvious that Dart as an AOT language would mean that the file being executed is just one snapshot. I would want to know if there is a way I can access the directory structure of package without having the end-user having to pass path values to me.
To give you some context, I want to load a dynamic library on runtime using dart:ffi, and do so within a package which will be published to pub.dev with the libraries. Do let me know if you have any ideas.
What I've tried so far:
Directory.current.path: This is obviously not going to work.
${File(Platform.resolvedExecutable).parent.path: This seems to be a workaround for Windows machines, I don't know how this would be useful for Linux, MacOS, or even Android and iOS for that matter.
Directory.fromUri(Platform.script) :
This leads me to the snapshot created by the compiler on Linux, nevertheless, of no use to me.
It definitely won't work with ahead-of-time compilation, because then the compiled code is nowhere near the source code.
If your program is being run on the stand-alone VM, and has direct access to the source code, you can potentially use Isolate.resolvePackageUri from dart:isolate to convert a known package: URI to a file:URI, which can then be used withdart:io` to load the file.
Future<File?> fileFromPackageUri(Uri packageUri) async {
var fileUri = await Isolate.resolvePackageUri(packageUri);
if (fileUri == null) return null; // No such pacakge.
return File.fromUri(fileUri);
}
Again, this only works when running from source. Otherwise you need to find a way to deploy your native library along with the Dart program and know where to find it.
A few questions about code generation with Dart:
Can dart generate a class at runtime with Dart for code running on the Dart VM?
Is there any sort of code generation equivalent to Java annotation processing at compile / pre run time?
1) Dart VM and dart2js don't support generating code at runtime.
One workaround is to generate code to a file and load it in a new isolate (can also be a data URI). The application can communicate with the generated code running in another isolate only by message passing.
2) This is what transformers are for, but transformers are only applied to dart2js (or pub serve at development time), but not to code run on the server side Dart VM.
https://github.com/dart-lang/build (currently only in developer preview) can be used for code generation for browser and server-side code. It's a tool that monitors source files and updates generated code when source file change.
I've now discovered that the dart team has a library for generating sources. It seems useful for generating sources pre-compile time: https://pub.dartlang.org/packages/source_gen
In Eclipse, I'm using the already packed ij.jar instead of the source code. I added the ij.jar file as an external jar in Eclipse. Every plugin shipped in the original ij.jar works fine after I imported from ij.
Currently, I'm trying to use functions in the third-party plugin StackReg. Does anyone know how I can import the classes inside StackReg? I've tried to add StackReg_.jar as an external jar. However, this does not work.
From quickly looking at the source of StackReg plugin, I see that the classes are in the default package. In java, importing classes from default package to a named package is not possible without using reflection.
Possible solutions are:
Put your classes in the default package. Then you can use the classes in the default package without importing them. Note that using default package is bad practice in java.
Use reflection: https://stackoverflow.com/a/561183/1903534
Alter the StackReg plugin to not use the default package. But this might not be compatible with its license and your solution will not be compatible with the original jar.
I imagine this is a common issue, but googling around hasn't presented a solution. I'm just having some trouble loading a library.
The source that I have for the library is utilizing static loading, which is fine. The rest of the libraries I am using are loaded dynamically.
The problem is that my program is now being loaded up as a library (it is a plugin), by a different application (a host). This means that the directory for the HOST executable, is NOT the program directory for my application.
The library that is being statically loaded (just a simple library for font rendering), is inside of my program's directory, and when loading my software as a plugin, it is not found. When I load up my software as a 'standalone' program (without a host), there is no issue.
I was able to resolve the issue by putting the 'missing' library into the folder for the host application, but this is a bad solution.
I was also able to resolve it by providing a direct path to the name of the library, but this is also a bad solution. I do not know where the end user will be installing my software.
Is there any way around this issue without having to rewrite the code to use dynamic loading?
To continue using static loading, must the library be registered? I think that registering this library is too invasive, as other programs may be using a different version of it.
const
ft_lib = 'freetype6.dll'; //here is our problem. I could put a direct path
//here, to fix it, but I will not know this path
//on an end-user's machine
type
FT_Library = Pointer;
function FT_Init_FreeType(out alibrary : FT_Library ) : FT_Error;
cdecl; external ft_lib name 'FT_Init_FreeType';
The program loader looks for DLLs on the system path. Just make sure that your freetype6.dll (and the DLLs that it requires) is either in the same directory as the host exe, or is in a directory that is in the file path (PATH environment variable).
For reference: http://msdn.microsoft.com/en-us/library/7d83bc18(v=vs.71).aspx
I would suggest that modifying PATH is a very invasive solution. I would recommend attempting to avoid that. You may be able to do that using SetDllDirectory. This will add a directory to the search path, but will make that change locally to your process.
Your host app should call SetDllDirectory immediately before loading your DLL. Then any dependencies of the DLL will be resolved using the modified search path. When the DLL has successfully loaded, call SetDllDirectory again to restore the search path to its default value.
If you aren't in control of the host then it might be tricky to implement this. You'd need to call SetDllDirectory in your DLL and then it would be too late. You could put another layer between the host and plugin. That layer could modify the DLL search path and then use LoadLibrary to load the DLL that used implicit linking.
The other obvious option is to stop using implicit linking. Use LoadLibrary to resolve all your dependencies. That's actually not as hard as it sounds.
In a modern Delphi you could use delay loading also. So long as the DLL search path is modified, before you call into the delay loaded imports, they will resolve.
Is there anywhere that can give you a tutorial or anything on creating a Debian package using Ant?
I'm being told its already a part of Ant but I've never seen any functions even remotely associated with it.
I don't want to use ant-deb-task either seeing as its not actually part of Ant.
There is no task for this in the core Ant distribution.
There are examples for ant-deb-task available in the examples file on the download page.
Another option is jdeb which also provides documentation.