VS project does not work with libCore.dll in release folder

Dear ROOTers,

new post, new problem! So I finally managed to set up the first basic version of my code and managed to run it on my computer. Yep, just on mine. Now I would like to be able to run it on other windows computers that might not have neither ROOT (heretics!) nor VS.

My project is a C++ windows form and (I think) I need the option /clr to compile it, which does not allow me to automatically generate an executable version with all the .dll dependencies (in other words I have to use /MD and /MDd options).

Thus, as I understand, I have to provide the “release” folder generated from VS together with all the .dll needed.

Long story short, I’ve made several attempts and found out that:

  • On my computer (with ROOT and VS)

I can take the “release” folder and make it run wherever I place it (of course, as I have all the libraries). But, as soon as I add “libCore.dll” in the same folder, the executable doesn’t work anymore: I can click it and nothing happens.
This happens only with “libCore.dll”, the executable still works fine with all the other ROOT .dll files

  • On other computers (no ROOT, no VS)

My program doesn’t work because they’re missing the libraries, and, as soon as I provide “libCore.dll” in the “release” folder, the executable behaves just like on my computer.
A really basic version of the code (i.e. just the windows form without any code using ROOT) works just fine. Thus I think we can exclude a .NET Framework issue.

What would you suggest? Is this an issue anyone has experienced before?

Thank you so much,
Filippo


ROOT Version: v6.22.02
Platform: Windows 10
Compiler: Microsoft Visual Studio Community 2019 (Version 16.7.4)


To make it short: running a ROOT application requires more than just its DLLs. There are icons, plugins and so on located in different folders relative to the ROOTSYS environment variable which should point to where ROOT has been installed.

So, I guess that means that there’s no way to get a precompiled program that uses ROOT libraries to work on a computer that has not ROOT installed?

Well, there are always several solution to a given problem, it it might be more complicated than simply installing ROOT. But you can try nevertheless. And if you search the forum you may even find someone who already tried…

Fair enough, thank you for the explanation. I’ll look deeper into it.

But, if I may, I’m still confused about the issue I’m having on my computer (i.e. when “libCore.lib” to the “release folder”), any idea why that could happen?

I’ll check, but it might be related to some initialization requiring libCore.dll to be in %ROOTSYS%\bin

1 Like

So the system (in libCore.dll) looks for the etc directory in %ROOTSYS%, then the bin directory to add it in the PATH…

Sorry for the delay, I got pretty busy in these days.

Ok, so I might have an issue here. If I look on my computer for the variable ROOTSYS

echo %ROOTSYS%

the output is just %ROOTSYS%, which, I would guess, means that the variable is not defined.
The ROOT bin directory is, instead already in PATH. Unlike etc which is not.
I’ll look how to properly define ROOTSYS on windows and try again

The %ROOTSYS% and %PATH% environment variables are set/modified by the thisroot.bat script (located in the ROOT bin directory)

Thanks!
I tried to run thisroot.bat using cmd as administrator. When I write echo %ROOTSYS% in the same session I get the correct folder, but after I close and reopen cmd the variable is not defined anymore.
Is this normal?

The same happens if I just execute thisroot.bat without udsing the command line

Yes, this is valid for the current session only

But you can also set those values on your computer in your computer properties → advanced system settings → environment variables