RE: [ROOT] root dictionaries in .NET

From: Philippe Canal (
Date: Wed Mar 31 2004 - 19:01:58 MEST

Hi John,

Indeed you have a problem with confusion of .lib and .dll
Here is the revelant extra for $ROOTSYS/test/Makefile.win32

EVENTLIB      = libEvent.lib

EVENTSO       = libEvent.$(DllSuf)

                BINDEXPLIB  $* $(EVENTO) > $*.def
                lib -nologo -MACHINE:IX86 $(EVENTO) -def:$*.def $(OutPutOpt)$(EVENTLIB)
                $(LD) $(SOFLAGS) $(LDFLAGS) $(EVENTO) $*.exp $(LIBS) $(OutPutOpt)$(EVENTSO)
                @echo "$(EVENTSO) done"

Note in particular that the argument in the lib command line is libEvent.lib


-----Original Message-----
From: Dr. John Krane []
Sent: Wednesday, March 31, 2004 10:53 AM
To: Valeri Fine
Cc: 'Philippe Canal';;
Subject: Re: [ROOT] root dictionaries in .NET

Hi everyone,

Using the Makefile technique, I was able to build my .lib library:

>  To see what I am speaking about you need to find 
>   1.  "Microsoft Studio .NET command prompt" icon
>   2.  "Click" that icon to get the famous "MS DOS black Window"
>   3.  At this point you should be able to invoke the MVC++ compiler "by

Unfortunately, now I am trying to link my .dll, which uses the classes 
from the .lib and I get a fatal error that the .lib is "invalid or 
corrupt".   I think it is because I don't quite understand the 
difference between a .dll and a .lib in Windows, and I'm making a single 
file that is a little bit of both...

At risk of wearing out people's patience, I include below the 
Makefile.win32 I'm using.  Perhaps a quick look from experienced eyes 
will reveal my mistakes. 

    - John

ObjSuf        = obj
SrcSuf        = cpp
ExeSuf        = .exe
DllSuf        = lib
OutPutOpt     = -out:

# Win32 system with Microsoft Visual C/C++
!include <win32.mak>
CC            = $(cc)
CPP           = $(cc)
CPPFLAGS      = $(cvarsdll) -EHsc  -nologo -G5 -GR -MD -DWIN32 \
                -DVISUAL_CPLUSPLUS -D_WINDOWS -I$(ROOTSYS)/include
CPPOPT        = -O2
#CPPOPT       = -Z7

LD            = $(link)
LDOPT         = -opt:ref
#LDOPT         = -debug
LDFLAGS       = $(LDOPT) $(conlflags) -nologo
SOFLAGS       = $(dlllflags:-pdb:none=)
ROOTLIBS      = $(ROOTSYS)/lib/libCore.lib \
                $(ROOTSYS)/lib/libCint.lib $(ROOTSYS)/lib/libMatrix.lib 
LIBS          = $(ROOTLIBS) $(guilibsdll) MSVCPRT.LIB

# Environmental variable definitions

ARRAYO       = TArrayQ.$(ObjSuf) TArrayQCint.$(ObjSuf)
MATRIXO      = TMatrixQ.$(ObjSuf) TMatrixQCint.$(ObjSuf)
MATRIXUO     = TMatrixQUtils.$(ObjSuf) TMatrixQUtilsCint.$(ObjSuf)
VECQO        = TVectorQ.$(ObjSuf) TVectorQCint.$(ObjSuf)

# *shared* library
KLIBO        = libKrane_root.$(DllSuf)

ARRAYS       = TArrayQ.$(SrcSuf)
MATRIXS      = TMatrixQ.$(SrcSuf)
MATRIXUS     = TMatrixQUtils.$(SrcSuf)
VECQS        = TVectorQ.$(SrcSuf)


# "Rules to make targets", specified with colon
all:            $(KLIBO)
OBJS       :    $(OBJS)

# Rule for library
$(KLIBO)   :    $(OBJS)
                BINDEXPLIB $* $(OBJS) > $*.def
		lib -nologo -MACHINE:IX86 $(OBJS) -def:$*.def $(OutPutOpt)$(KLIBO)
                $(LD) $(SOFLAGS) $(LDFLAGS) $(OBJS) $*.exp $(LIBS) $(OutPutOpt)$(KLIBO)
                @echo "$@ done"

                @rm -f $(OBJS) core *Cint*

                @rm -f $(OBJS) core *Cint* *~

.SUFFIXES: .$(SrcSuf)

###  Build the Dictionary files

TArrayQCint.$(SrcSuf):  TArrayQ.h TArrayQLinkDef.h
        @echo "Generating dictionary $@..."
        @$(ROOTSYS)\bin\rootcint -f TArrayQCint.$(SrcSuf) -c TArrayQ.h TArrayQLinkDef.h

TMatrixQCint.$(SrcSuf): TMatrixQ.h TMatrixQLinkDef.h
        @echo "Generating dictionary $@..."
        @$(ROOTSYS)\bin\rootcint -f TMatrixQCint.$(SrcSuf) -c TMatrixQ.h TMatrixQLinkDef.h

TMatrixQUtilsCint.$(SrcSuf):    TMatrixQUtils.h TMatrixQUtilsLinkDef.h
        @echo "Generating dictionary $@..."
        @$(ROOTSYS)\bin\rootcint -f TMatrixCUtilsCint.$(SrcSuf) -c TMatrixUtilsQ.h TMatrixQUtilsLinkDef.h

TVectorQCint.$(SrcSuf): TVectorQ.h TVectorQLinkDef.h
        @echo "Generating dictionary $@..."
        @$(ROOTSYS)\bin\rootcint -f TVectorQCint.$(SrcSuf) -c TVectorQ.h TVectorQLinkDef.h

#DEBUG := $(shell echo ROOTLIBS is --$(ROOTLIBS)-- 1>&2)

        $(CXX) $(CXXFLAGS) -c $<

This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:07 MET