Hi there,
I am a beginner in ROOT and VC++.
How can I import classes like TStopwatch or TComplex from .dll libraries of ROOT
using VC++ 8.0 environment?
I need this to build .exe file of the project to speed up the calculation.
When I tried to use method with FARPROC pointer the message that TStopwatch is not a class or namespace appears.
Was these DLLs compiled without __declspec() options to classes?
Is the only way to compile the ROOT project with classes support under Windows to use Cygwin?
Where can I find the detailed instruction on how to do this?
I’m not sure to really understand your problem, but you must link with the .lib files (i.e. add the libraries in the input field of the linker options of your project). If you don’t know how to proceed, just post a zip file with your project, and I will correct it.
I’m not sure to really understand your problem, but you must link with the .lib files (i.e. add the libraries in the input field of the linker options of your project). If you don’t know how to proceed, just post a zip file with your project, and I will correct it.
Cheers,
Bertrand.[/quote]
I have done this but with the same result. In this case I can use without any problem functions from .DLLs but can not use classes like TComplex or TStopwatch.
First of all, you have to include the declaration of TStopWatch in your code (i.e. #include “c:\root\include\TStopWatch.h”)
But the compilation will still fail with unresolved externals, since you have to link against ROOT libs…
And this code:
HINSTANCE fl5=LoadLibrary("c:\\root\\bin\\libCore.dll");
GetProcAddress(fl5, "Constructor");
Cannot work - how the system can guess which constructor has to be called ? is there any exported function called “Constructor” in libCore.dll ? I don’t think so…
Why not using the standard way of linking (with libCore.lib) ? do you really need to dynamically load the DLLs ?
– Bertrand.
[quote=“bellenot”]First of all, you have to include the declaration of TStopWatch in your code (i.e. #include “c:\root\include\TStopWatch.h”)
But the compilation will still fail with unresolved externals, since you have to link against ROOT libs…
And this code:
HINSTANCE fl5=LoadLibrary("c:\\root\\bin\\libCore.dll");
GetProcAddress(fl5, "Constructor");
Cannot work - how the system can guess which constructor has to be called ? is there any exported function called “Constructor” in libCore.dll ? I don’t think so…
Why not using the standard way of linking (with libCore.lib) ? do you really need to dynamically load the DLLs ?
– Bertrand.[/quote]
When I link corresponding ROOT libs (.lib files) I CAN NOT USE CLASSES like TComplex and TStopwatch.
I suppose that this works like some kind of redefinition of class TComplex.
I have thought before that including of TComplex and declaration of variable like
TComplex z;
is just enough. But such declaration leads to error in VC++ 8.0 environment.
[quote=“bellenot”]There is no problem declaring a variable like TComplex z;
To try, just modify Totpr.cpp as following:
int main()
{
TComplex a;
const int max_iter=50;
[...]
if(iter>max_iter) break;
}
a = TComplex::Sqrt(z);
}
[...]
You will see it works…
Bertrand.[/quote]
Thank you.
I have understood. My problem was in the way of initialization I should did this like
[quote=“bellenot”]First of all, you have to include the declaration of TStopWatch in your code (i.e. #include “c:\root\include\TStopWatch.h”)
But the compilation will still fail with unresolved externals, since you have to link against ROOT libs…
And this code:
HINSTANCE fl5=LoadLibrary("c:\\root\\bin\\libCore.dll");
GetProcAddress(fl5, "Constructor");
Cannot work - how the system can guess which constructor has to be called ? is there any exported function called “Constructor” in libCore.dll ? I don’t think so…
Why not using the standard way of linking (with libCore.lib) ? do you really need to dynamically load the DLLs ?
– Bertrand.[/quote]
Hello,
the word “Constructor” is there ??0TComplex@@QAE@XZ
or there ??0TStopwatch@@QAE@XZ for TStopwatch
But if I have .lib file the best way is to use it.
[quote=“SBegun”]Hi there,
I am a beginner in ROOT and VC++.
How can I import classes like TStopwatch or TComplex from .dll libraries of ROOT
using VC++ 8.0 environment?
I need this to build .exe file of the project to speed up the calculation.
When I tried to use method with FARPROC pointer the message that TStopwatch is not a class or namespace appears.
Was these DLLs compiled without __declspec() options to classes?
Is the only way to compile the ROOT project with classes support under Windows to use Cygwin?
Where can I find the detailed instruction on how to do this?
[quote=“fine”][quote=“SBegun”]Hi there,
I am a beginner in ROOT and VC++.
How can I import classes like TStopwatch or TComplex from .dll libraries of ROOT
using VC++ 8.0 environment?
I need this to build .exe file of the project to speed up the calculation.
When I tried to use method with FARPROC pointer the message that TStopwatch is not a class or namespace appears.
Was these DLLs compiled without __declspec() options to classes?
Is the only way to compile the ROOT project with classes support under Windows to use Cygwin?
Where can I find the detailed instruction on how to do this?
Hello,
I am working under Windows XP thus the .so files is not fit.
There is no other way to use Classes from .DLLs of ROOT as to include (link) corresponding .LIB files of ROOT under creation of object code file .OBJ and under creation of executable file .EXE.
FYI, ACliC works also on Windows (just replace .so by .dll)…
Cheers,
Bertrand.[/quote]
Thank you.
But when I have tried to make .dll from Totpr.cpp by .L Totpr.cpp+ in CINT
The error appears
root [20] .L Totpr.cpp++
Info in TWinNTSystem::ACLiC: creating shared library c:\root\Totpr_cpp.dll
’cl’ is not recognized as an internal or external command,
operable program or batch file.
Error: external preprocessing failed. (0)
!!!Removing c:\root\s340_1n.cxx c:\root\s340_1n.h !!!
Error: rootcint: error loading headers…
Error in : Dictionary generation failed!
Info in : Invoking compiler to check macro’s validity
’cl’ is not recognized as an internal or external command,
operable program or batch file.
root [21]