Hello,

 

Let's say, you have an executable (foo.exe) and DLL (bar.dll). In debug build, the DLL is renamed to "bar-d.dll" (See List-1). Now, the executable wants to LoadLibrary() the DLL. (See List-2). Is it possible to pass the actual DLL filename to foo.exe so that foo.exe can load the correct DLL for release / debug builds?

 

 

##########################

# List-1

##########################

import virtual-target : add-prefix-and-suffix ;

 

rule rename ( name : type ? : property-set ) {

    local postfix ;

    local properties = [ $(property-set).raw ] ;

    if <variant>debug in $(properties) { postfix += d ; }

   

    local result = $(name)-$(postfix:J=-) ;

   

    return [ add-prefix-and-suffix $(result) : $(type) : $(property-set) ] ; }

 

lib bar : bar.cpp

        : <tag>@rename

          <link>shared

;

 

exe foo : foo.cpp

        : <define>FOO_FILENAME=????

;

 

install . : bar foo ;

 

##########################

# List-2

##########################

 

#define STRING(s) # s

#define XSTRING(s) STRING(s)

 

int main(){

  // ...

  LoadLibrary(XSTRING(FOO_FILENAME))

  // ...

}

 

Motonari Ito