QPluginLoader can't find module - qt

I have created a plugin for my application. If I don't use the GDAL library in my code, my application can use this plugin (QPlugin loads it) and it works fine. But if I use classes from the GDAL library QPluginLoader can't load it and the errorstring() method returns ../serverplugin.dll Can't find module.
There are two exported symbols qt_plugin_instance and qt_plugin_query_verification_data in the plugin DLL (I found them with Dependency walker). QPluginLoader uses the QLibrary class internally to interface with the C symbols exported to the DLL. If I don't use GDAL I have only two exported symbols in all plugins at the beginning. When I use GDAL these two symbols are moved at the end of a big list of exported symbols. Maybe these two exported symbols should be at the beginning.
What am I doing wrong?

I had the same problem with QPluginLoader. In few words how I solved it: I create plugin library, let's say lib1.dll which use some stuff from lib2.dll. In my application I try to load lib1 via QPluginLoader.
QPluginLoader loader( adaptersDir.absoluteFilePath(fileName) );
AdapterInterface* adapterIface = qobject_cast<AdapterInterface*>(loader.instance());
In this case loader.instance() returns 0. Solution was to copy lib2.dll into application folder because an application use it for proper load plugin lib1.

QT_BEGIN_NAMESPACE
#define Plugin_iid "Plugin"
Q_DECLARE_INTERFACE(PluginInterface,Plugin_iid)
QT_END_NAMESPACE
Q_PLUGIN_METADATA(IID "PluginInterface" FILE "Plugin.json")
Q_INTERFACES(PluginInterface)

Related

Drupal9: installing problem PHP-encryption library

for encryption data i wants to use in Drupal9 the PHP-encryption library width "REAL AES" Module. But Drupal can not find the PHP-encryption library while enaple the "REAL AES" module.
It is very new to use PHP-encryption in Drupal9, so i think there can be a bug in code or in readme.txt of Installationprozess.
So my main question is: In Which folder do i have to install PHP-encryption-Code?
I installed by the hint of REAME.txt "composer require defuse/php-encryption". But it was unclear in which folder:
In Root of Server? or
In Drupal-Folder sites/all/libraries/php-encryption or
In Drupal-Folder of REal AES Module: modules/real_aes/defuse/
Question: Drupal9 works with composer. Do I have to activate the PHP-encryption library especially? for ex. in main composer.json ?
Thank you for your help, because I m new in Drupal9.
After activating the REAl AEs Module in Drupal9, the module wants to use the library. That does not work, so it shows the errormessage
Please install the Defuse PHP-encryption library via Composer. See README.txt
I use this Drupalmodule:
https://www.drupal.org/project/real_aes
PHP-encryption library:
https://github.com/defuse/php-encryption
So now im looking in the code of php-encryption library und found the Problem in checking the existens of a Class which causes the problem.
so this becomes false instead of true:
if (class_exists('\Defuse\Crypto\Crypto'))
in https://www.drupal.org/files/issues/2613682-3.patch
So the result is the text above "Please install the Defuse PHP-encryption library via Composer"...
but the class Crypto is in folder /defuse/src/Crypto.php
<?php
namespace Defuse\Crypto;
use Defuse\Crypto\Exception as Ex;
class Crypto
{
Now it works:
I had to install php-encryption-library with composer in folder of the module!

Deploy QT plugin with its own DLL depences

I have a QT application app.exe and a QT plugin plugin.dll. My plugin.dll depends on many other dynamic libraries (e.g. lib1.dll, lib2.dll and so on). To distribute my project I have this folder structure (ignoring QT libraries):
app.exe
plugins\
plugin.dll
lib1.dll
lib2.dll
lib3.dll
The problem is that there are too many dependences on libX.dll and I want to hide them in a plugin folder, e.g.:
app.exe
plugin\
plugin.dll
lib1.dll
lib2.dll
lib3.dll
But this way libraries libX.dll are "unseen" to my plugin, so that it cannot be loaded. Is there any way to solve this problem?
I am using this code to import libX.dll in plugin.dll's pro-file:
LIBS += -Lpath -l lib1 -l lib2 -l lib3
One of the ways of solving this problem is:
Link all libraries dynamically (at runtime)
Add extra location to search for the libraries
These changes should be done in plugin.dll code:
/* Declare a pointer to import function */
typedef void (*FUNCTION)();
FUNCTION f;
/* Make system search the DLLs in my plugin folder */
// Variable "app" contains directory of the application, not the plugin
QDir app = QDir(qApp->applicationDirPath());
// Combine path
QString plugin_path = app.filePath("plugins/");
// Adding full path for DLL search
SetDllDirectory(plugin_path.toStdWString().c_str());
/* Linking the library */
QLibrary mylib("mylib.dll");
f = (FUNCTION ) mylib.resolve("function");
if (f != NULL)
f(); // You got the function from DLL
else
return; // DLL could not be loaded
This solution has disadvanges:
It is not platform independent (I think you can avoid using SetDllDirectory in UNIX-like systems but I am not sure)
If you import a lot of functions you will have a lot of pointers
Does any one know pure Qt solution?

xquery error library modules cannot be evaluated or no namespace declared

When I deploy modules in JBoss, I'm getting errors:
Library modules cannot be evaluated.
Function 'hello' is in reserved namespace.
No namespace declared for 'm:hello'.
xquery version "3.0" encoding "utf-8";
import module namespace m = 'http://basex.org/modules/Hello' at 'HelloWorld2.xq';
m:hello("Universe")
I already had Helloworld2.xq file in my src/main/resources. It is not recognizing or showing as duplicate namespace. Can anyone help me with this?
Unless you are the owner of the domain "basex.org", you should probably use a different namespace for functions you write. Create a namespace in a part of URI space for which you actually do have some naming rights. That should clear at least the second error.
What relative URI to use to find a module appears to be a frequent source of confusion; if you are using BaseX, be sure to read the BaseX documentation on configuring BaseX via web.xml.

Loading library with dependency with QLibrary

Suppose I have two libraries, A.dll and B.dll. The library A depends on B. I want to load A into my project.
My project is in C:/Project. If I keep both A.dll and B.dll in C:/Project, I can load A with:
QLibrary lib("A");
lib.load();
This works fine. load() will return false if B.dll isn't in C:/Project, though.
The problem is I want to keep both A.dll and B.dll in C:/Project/lib. But when I move both libs to that location and try to load:
QLibrary lib("C:/Project/lib/A");
lib.load();
It fails. But this works if I keep A.dll in C:/Project/lib and B.dll in C:/Project.
How can I keep both libs in C:/Project/liband have A.dll load successfully?
Edit: the error message I get is "Cannot load library C:/Project/lib/A . The specified module could not be found."
Try using SetDllDirectory, see http://msdn.microsoft.com/en-us/library/ms686203%28VS.85%29.aspx
You should add into your system environment the path to C:/Project/lib, or from the Projects tab into your QT Creator edit the Path variable(add the path to your libraries)

"Error #1014: Class mx.core::BitmapAsset could not be found" while trying to use Runtime Shared Library

I've made a runtime shared library for my project, let's call it ResourceLibrary. It contains all of the embedded assets for my project (images, sounds, movie clips) and it's used as a singleton in a lot of other bits of code.
I am compiling it using this batch (Windows unfortunately):
SET normalstuff=--namespace+=http://ns.adobe.com/mxml/2009,${flexlib}/mxml-2009-manifest.xml --namespace+=http://www.adobe.com/2006/mxml,${flexlib}/mxml-manifest.xml --namespace+=library://ns.adobe.com/flex/spark,${flexlib}/spark-manifest.xml -external-library-path lib -external-library-path+=${flexlib}/libs -external-library-path+=${flexlib}/libs/player/10.0
call compc -source-path src/ -output lib-ext/resources.swc -include-namespaces+=http://MYPROJECT -namespace+=http://MYPROJECT,confs/ResourceLibrary-manifest.xml %normalstuff% -library-path+=data/characters -library-path+=data/menus -library-path+=data/icons/relationships -include-lookup-only=true
That makes my resources.swc file, which, when I include this swc in my library and have -static-link-runtime-shared-libraries=true. But I want to not embed my runtime shared libraries in my main swf (cuts down the file size from 10mb to ~3mb), so static-link-runtime-shared-libraries must be false.
When I run my code, however, I get this error:
[Starting debug session with FDB]
[Fault] exception, information=VerifyError: Error #1014: Class mx.core::BitmapAsset could not be found.
I've been raking my brain over this probably super simple solution, but everywhere I look the answer everyone else gets is "static-link-runtime-shared-libraries to true".
Anyone have any clues/ideas on where to start?
I figured this out but forgot to post here.
What you have to do is tell it where the swf to be used will be located, and what classes will be in it (the swc arg)
-runtime-shared-library-path=lib/MyLibrary.swc,MyLibrary.swf
I then extract the swc (using 7zip, but any works) and re-name the extracted swf to "MyLibrary.swf" and move it into the same directory as my main program.
If you're using a SDK that doesn't match the version of Flash Builder you're using, you may need to manually link to that SDK in the project properties.
You do know that creating a swc is not an RSL, right? swc = compile time library. swf = runtime library (or swz if it's Adobe signed libs).
http://livedocs.adobe.com/flex/3/html/help.html?content=rsl_01.html#168690
http://livedocs.adobe.com/flex/3/html/help.html?content=compilers_14.html

Resources