<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">On 3/21/2013 4:33 PM, Thompson, John
wrote:<br>
</div>
<blockquote
cite="mid:A98E80225E242E41AFC940ACBEBC1AF7F7CB24@USCULXMSG03.am.sony.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<meta name="Generator" content="Microsoft Word 14 (filtered
medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";
color:black;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
pre
{mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0in;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";
color:black;}
tt
{mso-style-priority:99;
font-family:"Courier New";}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
{mso-style-priority:99;
mso-style-link:"Balloon Text Char";
margin:0in;
margin-bottom:.0001pt;
font-size:8.0pt;
font-family:"Tahoma","sans-serif";
color:black;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:.5in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";
color:black;}
span.BalloonTextChar
{mso-style-name:"Balloon Text Char";
mso-style-priority:99;
mso-style-link:"Balloon Text";
font-family:"Tahoma","sans-serif";}
span.EmailStyle20
{mso-style-type:personal;
font-family:"Calibri","sans-serif";
color:#1F497D;}
span.EmailStyle21
{mso-style-type:personal;
font-family:"Calibri","sans-serif";
color:#1F497D;}
span.EmailStyle22
{mso-style-type:personal;
font-family:"Calibri","sans-serif";
color:#1F497D;}
span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-priority:99;
mso-style-link:"HTML Preformatted";
font-family:"Consolas","serif";
color:black;}
span.EmailStyle26
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Matthew,<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Thank
you so much! This was very enlightening.<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">I
didn’t know that a .exe file could have exports.<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">This
opens up new possibilities, even though it’s not a full
generic solution.<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">I’m
assuming symbols using declspec(export)’s would cause these
to be exported in the .exe as well.</span></p>
</div>
</blockquote>
Yes, they do.<br>
<br>
<blockquote
cite="mid:A98E80225E242E41AFC940ACBEBC1AF7F7CB24@USCULXMSG03.am.sony.com"
type="cite">
<div class="WordSection1">
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">In
the .def file, you had to use the mangled names, right?</span></p>
</div>
</blockquote>
Yes.<br>
<br>
<blockquote
cite="mid:A98E80225E242E41AFC940ACBEBC1AF7F7CB24@USCULXMSG03.am.sony.com"
type="cite">
<div class="WordSection1">
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">In
my experiment of a couple of years ago, I created a new
common header for each llvm/clang library which had the
purpose of #define’ing a (module name)_LINKAGE preprocessor
symbol to be used in the declarations of symbols to
exported/imported. Thus I could switch it between
declspec(export) and declspec(import) based on a flag input
from the build. I did this with an eye toward having either
a “big clang DLL” or individual clang library DLLs, using
build flags to switch between them.<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">We
could now do the same thing, except that clang.exe itself
could now be the “big clang DLL”. Assuming a DLL build of
clang is a future or never to be done thing, we could start
out adding the *_LINKAGE tags to just those items likely to
be used in a plugin, without worrying about breaking a DLL
build. This would probably be easier than dealing with
mangled names and the .def file. It might complicate the
plug-in writer’s lives though, since if they need a symbol
that wasn’t exported, they would need to patch clang for it.<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">I
know using import/export tags is a sore spot for many. But
at least with this scheme, it seems it would be less of a
hassle because the main build won’t general break if someone
forgets to add one.</span></p>
</div>
</blockquote>
This all seems reasonable to me.<br>
<br>
<blockquote
cite="mid:A98E80225E242E41AFC940ACBEBC1AF7F7CB24@USCULXMSG03.am.sony.com"
type="cite">
<div class="WordSection1">
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">I
wonder what the impact of an embedded export table would
have on the load time for clang.exe?<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">I
looked for some kind of “export all” option in VC++ and the
linker, but didn’t see one, and it probably would be a bad
idea anyway, because of the number of exports, and would hit
the (supposed) import limit anyway in the import library,
unless Microsoft has fixed or will fix it.</span></p>
</div>
</blockquote>
FYI, our clang.def has a little less than 400 symbols in it. And
keep in mind that we only exported what Polly was using.<br>
<br>
<blockquote
cite="mid:A98E80225E242E41AFC940ACBEBC1AF7F7CB24@USCULXMSG03.am.sony.com"
type="cite">
<div class="WordSection1">
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Comments
anyone from the llvm/clang community? I can’t work on it
right now, but I probably could later.<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">-John<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF
1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext">From:</span></b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext">
Matthew Curtis [<a class="moz-txt-link-freetext" href="mailto:mcurtis@codeaurora.org">mailto:mcurtis@codeaurora.org</a>]
<br>
<b>Sent:</b> Thursday, March 21, 2013 12:19 PM<br>
<b>To:</b> Thompson, John<br>
<b>Cc:</b> Gao, Yunzhong; '<a class="moz-txt-link-abbreviated" href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a>'<br>
<b>Subject:</b> Re: [PATCH] Implement a sane plugin API
for clang<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">On 3/20/2013 8:17 PM, Thompson, John
wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Hi
Matthew,</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Could
you point me to more information on how you got the
plug-in mechanism to work with clang on Windows?</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">I
understand the need to add access functions for static
data, but I don’t understand how you build the plugin DLL
in general.</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">How
does a clang.exe built from statically-linked libraries
have the necessary exports to satisfy the dynamic loading
of the plugin DLL?</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
</blockquote>
<p class="MsoNormal" style="margin-bottom:12.0pt">We made the
following change to clang's tools/driver/CMakeLists.txt<o:p></o:p></p>
<p class="MsoNormal"><tt><span style="font-size:10.0pt">diff
--git a/tools/driver/CMakeLists.txt
b/tools/driver/CMakeLists.txt</span></tt><br>
<tt><span style="font-size:10.0pt">index 2545610..a3fe292
100644</span></tt><br>
<tt><span style="font-size:10.0pt">---
a/tools/driver/CMakeLists.txt</span></tt><br>
<tt><span style="font-size:10.0pt">+++
b/tools/driver/CMakeLists.txt</span></tt><br>
<tt><span style="font-size:10.0pt">@@ -10,10 +10,17 @@ set(
LLVM_LINK_COMPONENTS</span></tt><br>
<tt><span style="font-size:10.0pt"> selectiondag</span></tt><br>
<tt><span style="font-size:10.0pt"> )</span></tt><br>
<tt><span style="font-size:10.0pt"> </span></tt><br>
<tt><span style="font-size:10.0pt;color:#009900">+if(MSVC)</span></tt><span
style="color:#009900"><br>
</span><tt><span style="font-size:10.0pt;color:#009900">+
set(def_file "clang.def")</span></tt><span
style="color:#009900"><br>
</span><tt><span style="font-size:10.0pt;color:#009900">+else(MSVC)</span></tt><span
style="color:#009900"><br>
</span><tt><span style="font-size:10.0pt;color:#009900">+
set(def_file "")</span></tt><span style="color:#009900"><br>
</span><tt><span style="font-size:10.0pt;color:#009900">+endif(MSVC)</span></tt><span
style="color:#009900"><br>
</span><tt><span style="font-size:10.0pt;color:#009900">+</span></tt><span
style="color:#009900"><br>
</span><tt><span style="font-size:10.0pt"> add_clang_executable(clang</span></tt><br>
<tt><span style="font-size:10.0pt"> driver.cpp</span></tt><br>
<tt><span style="font-size:10.0pt"> cc1_main.cpp</span></tt><br>
<tt><span style="font-size:10.0pt"> cc1as_main.cpp</span></tt><br>
<tt><span style="font-size:10.0pt;color:#009900">+
${def_file}</span></tt><span style="color:#009900"><br>
</span><tt><span style="font-size:10.0pt"> )</span></tt><br>
<tt><span style="font-size:10.0pt"> </span></tt><br>
<tt><span style="font-size:10.0pt"> target_link_libraries(clang</span></tt><br>
<tt><span style="font-size:10.0pt">@@ -40,6 +47,10 @@
target_link_libraries(clang</span></tt><br>
<tt><span style="font-size:10.0pt"> </span></tt><br>
<tt><span style="font-size:10.0pt"> set_target_properties(clang
PROPERTIES VERSION ${CLANG_EXECUTABLE_VERSION})</span></tt><br>
<tt><span style="font-size:10.0pt"> </span></tt><br>
<tt><span style="font-size:10.0pt;color:#009900">+if(MSVC)</span></tt><span
style="color:#009900"><br>
</span><tt><span style="font-size:10.0pt;color:#009900">+
set_target_properties(clang PROPERTIES ENABLE_EXPORTS
true)</span></tt><span style="color:#009900"><br>
</span><tt><span style="font-size:10.0pt;color:#009900">+endif(MSVC)</span></tt><span
style="color:#009900"><br>
</span><tt><span style="font-size:10.0pt;color:#009900">+</span></tt><span
style="color:#009900"><br>
</span><tt><span style="font-size:10.0pt"> add_dependencies(clang
clang-headers)</span></tt><br>
<tt><span style="font-size:10.0pt"> </span></tt><br>
<tt><span style="font-size:10.0pt"> if(UNIX)</span></tt><o:p></o:p></p>
<p class="MsoNormal"><br>
Note that on Windows we only support CMake builds.<br>
<br>
Documentation for ENABLE_EXPORTS is here: <a
moz-do-not-send="true"
href="http://www.cmake.org/cmake/help/v2.8.10/cmake.html#prop_tgt:ENABLE_EXPORTS">http://www.cmake.org/cmake/help/v2.8.10/cmake.html#prop_tgt:ENABLE_EXPORTS</a><br>
<br>
On the plug-in side we just added 'clang' to the list of
Polly's target link libraries.<br>
<br>
<br>
<br>
<o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">How
do you get the list of symbols to import in the plugin DLL
build? Do you manually collect it from a bare link of the
plug-in .obj’s with no library references?</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal">I wish I could say I did something
intelligent here, but unfortunately this was a manual process.
I would attempt to link, note any unresolved externals, add
them to the def file, and then relink. I don't consider this
to be a maintainable solution in general. However at the time
we were under pressure to release and discovered our Windows
issues very late. So I did not spend much time thinking about
a better solution to managing the exports.<br>
<br>
<br>
<o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Or
did you succeed in building a DLL-based version of clang?
(Not one big clang DLL like I was experimenting with, but
the normal libraries as DLLs.) If so, how did you do the
exports and imports in general?</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal">No. We're just building a stand-alone clang
executable.<br>
<br>
<br>
<o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Doing
so without declspec(import/export) seemed problematic
because of the 16K limit on the number of exports or
some-such. I know exporting everything in one big DLL would
exceed that, but I’m not sure about separate DLLs.</span><o:p></o:p></p>
<p class="MsoNormal">Hmm. We did not run into any size
limitations. Perhaps because we were exporting just what Polly
needed.<br>
<br>
<br>
<o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">How
do you register the plugin’s action? In my hack, I had to
have the plugin DLL provide a named function derived from
the plug-in name in order for clang to find it.</span><o:p></o:p></p>
<p class="MsoNormal">We didn't have to do anything special here.
Static initializers in the Polly dll run on load which
register the Polly passes (see lib/RegisterPasses.cpp in the
Polly source). Is there a difference in the way that back-end
plug-ins work versus clang AST plug-ins?<br>
<br>
Hope this helps.<br>
<br>
Cheers,<br>
Matthew<br>
<br>
<br>
<br>
<o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Thanks.</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">-John</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<div>
<div style="border:none;border-top:solid #B5C4DF
1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">
Gao, Yunzhong
<br>
<b>Sent:</b> Wednesday, March 20, 2013 2:42 PM<br>
<b>To:</b> Thompson, John<br>
<b>Cc:</b> 'Matthew Curtis'; '<a moz-do-not-send="true"
href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a>'<br>
<b>Subject:</b> RE: [PATCH] Implement a sane plugin API
for clang</span><o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Hi
John,</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">The
other day I ran across a post by Matthew of the Polly team
and it seems that the Polly</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">team
might have made some progress regarding plug-in support on
Windows.</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><a
moz-do-not-send="true"
href="http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20130311/168147.html">http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20130311/168147.html</a></span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Although
I do not fully understand their implementation, it sounds
like the Polly team was</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">not
trying to add __declspec(dllimport/dllexport) all over the
clang/llvm source base. They</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">used
a .def file to export the necessary symbols from the clang
executable, and then they</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">just
tried to use the imported symbols without
__declspec(dllimport). According to the</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">MSDN
blog entry below, dllimport is not necessary for function
calls and is only necessary</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">for
data access. I am cc’ing Matthew in case I misunderstood
Polly’s implementation.</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><a
moz-do-not-send="true"
href="http://blogs.msdn.com/b/russellk/archive/2005/03/20/399465.aspx?wa=wsignin1.0">http://blogs.msdn.com/b/russellk/archive/2005/03/20/399465.aspx?wa=wsignin1.0</a></span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">I
think both the Cygwin and the mingw environments on Windows
provide a dlltool</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">executable
that can automate the generation of .def files from either
the object files or a</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">static
library. I am not aware of equivalent tools in the Visual
Studio package; you may have</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">to
write some scripts to extract and package the symbols if you
are using Visual Studio.</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">HTH,</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">-
Gao</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<div>
<div style="border:none;border-top:solid #B5C4DF
1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">
<a moz-do-not-send="true"
href="mailto:cfe-commits-bounces@cs.uiuc.edu">cfe-commits-bounces@cs.uiuc.edu</a>
[<a moz-do-not-send="true"
href="mailto:cfe-commits-bounces@cs.uiuc.edu">mailto:cfe-commits-bounces@cs.uiuc.edu</a>]
<b>On Behalf Of </b>Thompson, John<br>
<b>Sent:</b> Friday, March 15, 2013 6:04 PM<br>
<b>To:</b> <a moz-do-not-send="true"
href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<b>Subject:</b> RE: [PATCH] Implement a sane plugin API
for clang</span><o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Hi
Sean,</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">I
missed the discussion, but I saw your message and wanted to
find out where things stood on the plug-in API with respect
to Windows.</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">A
year or two ago I wrote a plug-in for Clang for generating
LUA bindings, and developing on Windows, found that the
plug-in mechanism didn’t work on Windows, because it relies
on how *nix systems do DLLs. Unfortunately, in Windows
land, a plug-in DLL would have to be linked with Clang
libraries which are DLLs, and apparently building the Clang
libraries as DLLs is problematic, due to the build system
and the messy business of importing/exporting symbols.</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">I
managed to skirt the issue by still building the plug-in
against the static libraries, and hacking clang to look up
call an entry point function with a name based on the
plug-in name so it could hook up the objects in the
plug-in. This, of course, was kind of dangerous, because
the plugin module and the clang executable would have
totally separate static data areas, not to mention the
duplicated code segments.</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Then
I did some work on making a big Clang DLL, to skirt some of
the DLL import/export issues, just exporting the symbol
references needed between the driver and the library, using
some header conventions for handling the exports. I
intended to pursue this further, and try to resolve the
clang DLL build issues, but haven’t been able to get back to
it.</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Has
anyone else worked on resolving the plugin issues for
Windows or the Clang-libraries-as-DLLs build?</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">-John</span><o:p></o:p></p>
<div>
<div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
</div>
<p class="MsoNormal"><br>
<br>
<br>
<o:p></o:p></p>
<pre>-- <o:p></o:p></pre>
<pre>Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation<o:p></o:p></pre>
</div>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation</pre>
</body>
</html>