Boost logo

Boost-Build :

From: Alexey Pakhunov (alexeypa_at_[hidden])
Date: 2005-05-24 05:50:03


On 5/19/05, Alexey Pakhunov <alexeypa_at_[hidden]> wrote:

> There are still some problems though:

Just to summarize what I have done. I tried several solutions allowing
to build .idl via simple including .idl to the list of sources
(without manual including generated xxx_i.c, xxx_i.p and
xxx_dlldata.c). The solution I end up with (see the attahced files)
does not look really beautiful though. Using this patch you will be
able to build ATL COM dll and proxy dll using the following jam file:

---
# Use 'fake' typelib target to invoke midl.exe
typelib xxx-typelib
:
xxx.idl 
;
lib xxx
:
xxx.cpp 
xxx.rc
# typelib converts to the list of .c files that should be
included to the library
xxx-typelib
:
<link>shared
<def-file>xxx.def
# building COM dll
<proxystub>no
# required to include files generated by midl.exe
<implicit-dependency>xxx-typelib
<define>WIN32
;
lib xxxps
:
# typelib converts to the list of .c files that should be
included to the library
xxx-typelib
:
<link>shared
<def-file>xxxps.def
# generate sources for proxystub DLL
<proxystub>yes
<implicit-dependency>xxx-typelib
<define>WIN32
<define>REGISTER_PROXY_DLL
;
---
The key points here is <proxystub> feature. It affects the way how the
files generated by midl.exe will be included to the library. There are
three possible galues: 'no', 'yes' and 'merge'. See usage of no and
yes above. 'merge' is used to build merged COM/proxy dll. Setting
proper defines is also crucial.
Now I need an advise from experienced Boost.Build'ers. :-) I fill like
I'm heading in a wrong direction. Instead of doing all the stuff above
we can define simple rule (an corresponding actions) that describes
exactly what midl.exe does. I.e.:
---
generators.register-c-compiler msvc.compile.idl : IDL : TLB H C(%_i)
C(%_p) C(%_dlldata) : <toolset>msvc ;
---
And then manually include generated sources we need:
---
tlb xxx-typelib
:
xxx.idl 
;
lib xxx
:
# includes xxx_i.c
xxx.cpp 
xxx.rc
:
<link>shared
<def-file>xxx.def
# required to include files generated by midl.exe
<implicit-dependency>xxx-typelib
<define>WIN32
;
lib xxxps
:
# includes xxx_i.c, xxx_p.c, xxx_dlldata.c
xxxps.cpp
:
<link>shared
<def-file>xxxps.def
<implicit-dependency>xxx-typelib
<define>WIN32
<define>REGISTER_PROXY_DLL
;
---
In case of merged COM/proxy dll it will be
---
tlb xxx-typelib
:
xxx.idl 
;
lib xxx
:
# includes xxx_i.c, xxx_p.c, xxx_dlldata.c
# in fact xxx.cpp is dlldatax.c
xxx.cpp 
# in fact xxx.h is dlldatax.h
xxx.h 
xxx.rc
:
<link>shared
<def-file>xxx.def
# required to include files generated by midl.exe
<implicit-dependency>xxx-typelib
<define>WIN32
<define>REGISTER_PROXY_DLL
<define>_MERGE_PROXYSTUB
;
---
So, a developer will need to define all required properties and
include all sources he needs manually. As a benefit we get simplicity
and flexibility. Drawback - setting all required properties without
good howto document is not obvious.
-- 
Best regards,
Alexey Pakhunov.
 ------=_Part_4589_26156814.1116931803245 Content-Type: application/octet-stream; name="idl.jam"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="idl.jam"
[Attachment content not displayed.] ------=_Part_4589_26156814.1116931803245 Content-Type: application/octet-stream; name="msvc.diff"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="msvc.diff"
[Attachment content not displayed.] ------=_Part_4589_26156814.1116931803245-- 

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