Boost logo

Boost-Build :

From: Hugo Duncan (hugoduncan_at_[hidden])
Date: 2006-11-24 13:48:50


Hi,

I have a dll that was built using cygwin, and which I would like to use
with msvc. To do so I need to generate a .def file from the dll using
"dumpbin" and run "lib" to generate the .lib file.

As a batch file I have, the following:

       CALL "C:\Program Files\Microsoft Visual Studio 8\VC\vcvarsall.bat"
        DUMPBIN /exports %1.dll | sed -nf exports.sed >> $1.def
        lib /DEF:%1.def /MACHINE:IX86 /OUT:%1.lib

As I have multiple dll's to convert I would like to perform these steps
with bbv2.

The def file seems to be no problem, but I am having a hard time coming up
with a generator for the lib file. I always end up getting "Duplicate
name of actual target:" errors.

Obviously there is an interaction with the built in rules, but I can not
see how to solve this. I have been trying this for some time now, so any
help is appreciated.

Hugo

---------------

error: Duplicate name of actual target: <p..\bin.v2\gsl\msvc\debug>gsl.lib
error: previous virtual target { msvc%msvc.link.dll-gsl.lib.IMPORT_LIB
{ libfromdll%libfromdll.libfile-gsl.lib.STATIC_LIB
{ libfromdll%libfromdll.deffile-gsl.def.DEF { gsl.dll.SHARED_LIB } } } }
error: created from ./gsl
error: another virtual target
{ libfromdll%libfromdll.libfile-gsl.lib.STATIC_LIB
{ libfromdll%libfromdll.deffile-gsl.def.DEF { gsl.dll.SHARED_LIB } } }

---------------

libfromdll.jam

import generators ;
import type ;

type.register DEF : def ;
generators.register-standard libfromdll.deffile : SHARED_LIB : DEF :
<toolset>msvc ;
generators.register-standard libfromdll.libfile : DEF : STATIC_LIB ;

actions deffile
{
   CALL "C:\Program Files\Microsoft Visual Studio 8\VC\vcvarsall.bat"
   ECHO EXPORTS > $(<)
   DUMPBIN /exports $(>) | sed -nf exports.sed >> $(<)
}

actions libfile
{
   CALL "C:\Program Files\Microsoft Visual Studio 8\VC\vcvarsall.bat"
   lib /DEF:$(>) /MACHINE:IX86 /OUT:$(<)
}

and then in my jamfile I can say

import libfromdll ;
def gsl.def : gsl.dll ;
lib gsl : gsl.def ;


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk