Fix for compiling ROOT extension .dlls with MS Visual C++ 6.0

From: Jonathan M. Gilligan (jonathan.gilligan@vanderbilt.edu)
Date: Wed Nov 04 1998 - 23:18:29 MET


Enclosed is a python script to fix .def files emitted by BINDEXPLIB in
conjunction with Visual C++ 6.0. It works on my system and while I haven't
gotten any official word on the new name-decoration scheme that MS uses, it
should be generally applicable. It simply goes through the .def file
produced by BINDEXPLIB.EXE and removes indented lines that begin _real
(i.e., invalid attempts to export references to floating point literals.

I also enclose a snippet from a makefile to show how to use the script. I
like python, but it should be trivial to adapt it to whatever scripting
language one likes.

I hope this is useful to others.

Jonathan

========================== fixdef.py ===================
import sys
import re

def ProcessLine(line):
	# MS creates named variables for float and double literals	
	# These are names _real@4@... or _real@8@... respectively.
	# Variables, functions, and classes do not begin with this
	# decoration, so this should be a safe test.
	# We look for output from BINDEXPLIB and delete lines exporting
	# symbols that begin _real.
	if re.match('^\s+_real',line) == None :
		return line
	else:
		return None

def ProcessFile(input, output):
	for line in input.readlines():
		ol = ProcessLine(line)
		if (ol != None):
			output.write(ol)

iname = sys.argv[1]
oname = sys.argv[2]
input = open(iname,'r')
output = open(oname,'w')
ProcessFile(input,output)
input.close()
output.close()
========================== end fixdef.py  ===================

========================== from makefile ===================
$(DEFFILE):	$(OBJS)
		BINDEXPLIB -o temp.def DPool $(OBJS)
		$(PYTHON) fixdef.py temp.def $(DEFFILE)

$(DPOOLLIB):	$(DEFFILE) $(OBJS)
              lib /nologo /MACHINE:IX86 $(OBJS) /def:$(DEFFILE)
$(OutPutOpt)$(DPOOLLIB)
 
$(DPOOLDLL):    $(OBJS) $(DPOOLLIB)
                $(LD) $(SOFLAGS) $(OBJS) DPool.exp $(LIBS)
$(OutPutOpt)$(DPOOLDLL)
                @echo "DPool.dll done"
========================= end from makefile ===================
===========================================================================
Jonathan M. Gilligan                     <jonathan.gilligan@vanderbilt.edu>
Research Assistant Professor and Associate Director          (615) 343-2957
Center for Molecular and Atomic Studies at Surfaces           Fax: 343-1708
Dept. of Physics and Astronomy, Box 1807-B                   Sec'y 322-6438
Vanderbilt University, Nashville, TN 37235                    Lab: 343-7578



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:39 MET