Re: [ROOT] Building 3.05/3 shared library on Win2k

From: Nick van Eijndhoven (Nick@phys.uu.nl)
Date: Tue Mar 25 2003 - 09:57:18 MET


Hi Ed,
No need to perform all these complicated exercises.
Attached you find a small script mklibs.txt (renamed from
mklibs.bat to satisfy some email filters) which creates
a ROOT loadable DLL of private user's classes.
It assumes the use of MSVC++ 6.0 and as you can see the compiler
options are minimal.
In addition you see that I use also a Headers.h and Linkdef.h
file. This is a "trick" to circumvent the problem that one can't
use wildcarding like *.h in the rootcint command.
These sort of scripts I am using already for years and so far
it worked without any problems.

                                        Cheers,
                                         Nick.

-- 
Dr. Nick van Eijndhoven mailto:nick@phys.uu.nl http://www.phys.uu.nl/~nick
--------------------------------------------------------------------------
Org.:    Utrecht University, Faculty of Physics and Astronomy
Address: Princetonplein 5, NL-3584 CC Utrecht, The Netherlands
Phone:   +31-30-2532331(direct) +31-30-2531492(secr.)  Fax: +31-30-2518689
CERN:    +41-22-7679751(direct) +41-22-7675857(secr.)  Fax: +41-22-7679480
Offices: Buys Ballot laboratory Room 710 (Utrecht)   B23 1-020 (CERN)
--------------------------------------------------------------------------
 

Ed Oltman wrote:
> 
> Hello,
>  I am attempting to follow the instructions in
> http://root.cern.ch/root/Version305.html for building a dll under Win2k.
> Rather than using a makefile, I've been building my dll using the VC++ 6.0
> project facility.  I've added the /GX option and I've attempted to fore the
> MSVCPRT runtime to load, but I cannot do it:  Here's link options:
> 
> libCore.lib libCint.lib libHist.lib libMinuit.lib libGraf.lib libGraf3d.lib
> libGpad.lib libTree.lib libRint.lib libPostscript.lib libMatrix.lib
> libPhysics.lib massdata.lib MSVCPRT.LIB kernel32.lib user32.lib gdi32.lib
> advapi32.lib /nologo /dll /pdb:none /machine:I386
> /out:"release/analysis.dll" /implib:"release/analysis.lib"
> /libpath:"$(ROOTSYS)\lib"
> 
> (note: I added MSVCPRT.LIB to the list - I MSVCIRT.LIB was never there -
> VC++ must have inferred it)
> 
> And here's my compile options:
> 
> /nologo /G5 /MD /W3 /GR /GX /O2 /I "$(ROOTSYS)\include" /D "_DLL"
> /D "_MT" /D "NDEBUG" /D "WIN32" /D "VISUAL_CPLUSPLUS" /D
> "_WINDOWS" /FR"release/" /Fo"release/" /Fd"release/" /FD /c
> 
> When I examime the dependancies with Dependency Walker, I find that
> MSVCPRT.DLL is not used, but MVSCIRT.DLL called by libCINT.  Is this a
> problem?
> 
> Ed Oltman



@echo off rem **************************************************************************** rem * Script to create an MSVC++ LIB and relocatable DLL from *.cxx files rem * rem * Usage : rem * ------- rem * mklibs export : ROOT loadable DLL and export LIB are created rem * mklibs full : ROOT loadable DLL and full LIB version are created rem * rem * Notes : rem * ------- rem * 1) "mklibs export" is the default, enabling ROOT loadable library creation rem * via 'double clicking'. rem * rem * 2) Providing unsupported options results in displaying the help info. rem * rem * This script creates ralice.lib and ralice.dll from all .h and .cxx files rem * in the current directory. rem * rem * In view of the ROOTCINT processing, the following two standard files rem * are always required : rem * rem * RALICEHeaders.h : containing an include of all .h files rem * RALICELinkDef.h : containing the #pragma's to define all classes rem * rem * --- NvE 04-apr-2000 UU-SAP Utrecht rem **************************************************************************** echo . echo === Automatic ROOT library production of files ralice.lib and ralice.dll === echo . rem --- The option strings for MSVC++ DLL compilation and linking --- set mscomp=/nologo /c /Ze /TP /MD /GR /GX /I%ROOTSYS%\include set msdll=/nologo /Ze /TP /MD /LD /GD /GR /GX /I%ROOTSYS%\include set mslink=/ENTRY:_DllMainCRTStartup@12 %ROOTSYS%\lib\*.lib if "%1" == "" goto export if "%1" == "export" goto export if "%1" == "full" goto full rem --- Displaying of the help info --- echo **************************************************************************** echo * Script to create an MSVC++ LIB and relocatable DLL from *.cxx files echo * echo * Usage : echo * ------- echo * mklibs export : ROOT loadable DLL and export LIB are created echo * mklibs full : ROOT loadable DLL and full LIB version are created echo * echo * Notes : echo * ------- echo * 1) "mklibs export" is the default, enabling ROOT loadable library creation echo * via 'double clicking'. echo * 2) Providing unsupported options results in displaying the help info. echo * echo * This script creates ralice.lib and ralice.dll from all .h and .cxx files echo * in the current directory. echo * echo * In view of the ROOTCINT processing, the following two standard files echo * are always required : echo * echo * RALICEHeaders.h : containing an include of all .h files echo * RALICELinkDef.h : containing the #pragma's to define all classes echo **************************************************************************** goto end :export echo *** Creation of ROOT loadable export libraries echo. rem --- Set the RALICE source directory as working directory cd .. rem --- Creation of ROOT dictionary --- rootcint zzzralicedict.cxx -c RALICEHeaders.h RALICELinkDef.h rem --- Compilation step --- cl %mscomp% *.cxx rem --- Creation of the export LIB --- bindexplib ralice *.obj > ralice.def lib /nologo /machine:IX86 *.obj /def:ralice.def /out:ralice.lib rem --- Creation of the DLL --- link /nologo /machine:IX86 /DLL *.obj ralice.exp %mslink% /OUT:ralice.dll rem --- Move the created libs to the SCRIPTS subdirectory move ralice.lib .\scripts move ralice.dll .\scripts rem --- Delete all intermediate files --- del .def del ralice.def del ralice.exp del zzzralicedict.h del zzzralicedict.cxx del *.obj echo. echo *** mklibs done. goto end :full echo *** Creation of ROOT loadable full version libraries echo. rem --- Set the RALICE source directory as working directory cd .. rem --- Creation of ROOT dictionary --- rootcint zzzralicedict.cxx -c RALICEHeaders.h RALICELinkDef.h rem --- Creation of the DLL --- cl %msdll% *.cxx /link %mslink% /OUT:ralice.dll rem --- Creation of the full version LIB --- lib /nologo /machine:IX86 *.obj /out:ralice.lib rem --- Move the created libs to the SCRIPTS subdirectory move ralice.lib .\scripts move ralice.dll .\scripts rem --- Delete all intermediate files --- del .def del zzzralicedict.h del zzzralicedict.cxx del *.obj echo. echo *** mklibs done. goto end :end rem --- End of script ---



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:10 MET