Plugin compiles fine... but not loading

Questions related to plugins development
Post Reply
acotti
Posts: 5
Joined: Wed Oct 25, 2017 9:30 am

Plugin compiles fine... but not loading

Post by acotti »

Hi,

I have some strange behaviour and I'm not sure how to solve these.
I'm working with Windows 10 and MSVS15.
I have a plugin project that compiles "apparently" without error, as you can see below.
qEG_compilation.JPG
qEG_compilation.JPG (131.57 KiB) Viewed 16430 times
The install build seems also ok
qEG_install.JPG
qEG_install.JPG (150.16 KiB) Viewed 16430 times
And the compiled plugin is copied into the final folder.

When I lauched CC in debug mode in msvs, I've got the lines in the log of CC and note that file does exist at this address! I'm not sure why there is a mix of / and \ in the file pathes though!
qEG_inCC.JPG
qEG_inCC.JPG (38.42 KiB) Viewed 16430 times
And in the log of msvs I can read the following:

'CloudCompare.exe' (Win32): Loaded 'C:\Lower9th_dev\CloudCompareCompile\CloudCompare_debug\plugins\QELITGEOMATICd.dll'. Symbols loaded.
'CloudCompare.exe' (Win32): Unloaded 'C:\Lower9th_dev\CloudCompareCompile\CloudCompare_debug\plugins\QELITGEOMATICd.dll'

Note that if I comment out a class instantiation (from an external lib) in my plugin everything works and the plugin is indeed loaded and functionnal. So it seems to be some kind of linkage issue or execution/instantiation issue of else!
The class that seems to cause the problem was tested and used in other programs successfully.

Any ideas or pointers why and where I should look to find out what is going on?

Thanks
Antoine
daniel
Site Admin
Posts: 7710
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Plugin compiles fine... but not loading

Post by daniel »

If you use an external library, it probably comes with its own DLLs. These DLLs must be copied next to the plugin DLL (or next to CloudCompare.exe). The message returned by the Qt component that loads the DLL is a bit misleading, but actually if the DLL can't be loaded because its dependencies are not found, then you'll get this message stating that the 'module' could not be found...

You can use "Dependency Waker" on the DLL file of your plugin to spot the missing modules.
Daniel, CloudCompare admin
acotti
Posts: 5
Joined: Wed Oct 25, 2017 9:30 am

Re: Plugin compiles fine... but not loading

Post by acotti »

Evening Daniel,

Thanks for your response.
I get the point, but have a follow-up question as I'm not fluent in DLL.
As it stands, I've compiled the external libraries (it's a set of 4 libs interconnected) as .lib as I wanted to to some static linking with CC plugin.
If I understand correctly, I'd better compile everything as .dll, is this correct? and then copy the 4 .dll in CC folder with the plugin dll.

Thanks
Antoine
daniel
Site Admin
Posts: 7710
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Plugin compiles fine... but not loading

Post by daniel »

No compiling as much libraries as static libraries is a good thing (if you have the right to do so: some licences don't allow this ;). The less DLLs you have the better I think. However in your case at least one of these libraries seems to have a DLL as dependency (Dependency Walker should tell you).

Pay attention also that libraries compiled as DLLs can also have a .lib (for linkage). I mean a .lib doesn't mean that the library is actually 'static'.
Daniel, CloudCompare admin
acotti
Posts: 5
Joined: Wed Oct 25, 2017 9:30 am

Re: Plugin compiles fine... but not loading

Post by acotti »

Thanks Daniel, problem solved...
Post Reply