<div dir="ltr">One more,<div><br></div><div>I couldn't build the libswiftCore.dll which can be used for Hello.swift. At least one symbol _TMSS is not dllexported.</div><div>(But I could build the dll with dlltool.exe which make all symbols to be dllexported)</div><div><br></div><div>To find out the reason, I built a Swift.ll instead of the Swift.obj for the libswiftCore.dll. The Swift.ll are built from many stdlib/public/core/*.swift and core/8/*.swift files, and about 50MB.</div><div><br></div><div>In that file, I could find many dllexport symbols, like</div><div><div>@_TZvOs7Process5_argcVs5Int32 = dllexport global %Vs5Int32 zeroinitializer, align 4<br></div></div><div>and Hello.ll uses them,</div><div><div>@_TZvOs7Process5_argcVs5Int32 = external dllimport global %Vs5Int32, align 4</div></div><div><br></div><div>In the case of _TMSS, Hello.ll uses the same way,</div><div><div>@_TMSS = external dllimport global %swift.type, align 8</div></div><div>But, Swift.ll did not declared with dllexport.</div><div><div>@_TMSS = alias %swift.type, bitcast (i64* getelementptr inbounds (<{ i8**, i64, i64, %swift.type*, i64 }>, <{ i8**, i64, i64, %swift.type*, i64 }>* @_TMfSS, i32 0, i32 1) to %swift.type*)</div></div><div><br></div><div>How we can make @_TMSS also has the dllexport? Or any other solution ?</div><div><br></div><div><br></div><div>-Han Sangjin</div><div><br></div><div><br></div><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">2016-05-08 8:01 GMT+09:00 Sangjin Han <span dir="ltr"><<a href="mailto:tinysun.net@gmail.com" target="_blank">tinysun.net@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi all,<div><br></div><div>I merged Saleem's #2080 to my working branch, and did some experiment.</div><div><br></div><div>I could compile easily Hello.swift with #2080 merged one.</div><div><br></div><div><div> swiftc -c -o Hello.obj Hello.swift</div><div> clang -o Hello.exe Hello.obj -llibswiftCore -llibswiftSwiftOnoneSupport -Wl,<some link options></div></div><div><br></div><div>Without #2080, I should use the *.ll-modifying-trick. It is perfect in this example.</div><div><br></div><div>But, we need the way to disable dllimport. The immediate mode did not work.</div><div><br></div><div> swift Hello.swift</div><div> LLVM ERROR: Program used external function '__imp_globalinit_33_1BDF70FFC18749BAB495A73B459ED2F0_func3' which could not be resolved!</div><div><br></div><div><div> swift -O Hello.swift</div><div> LLVM ERROR: Program used external function '__imp__swift_getExistentialTypeMetadata' which could not be resolved!</div></div><div><br></div><div>It seems swift.exe call directly the function in the DLL without import library.</div><div><br></div><div>The feature also needed when we link to static library.</div><div><br></div><div>I don't know about the SIL, IR, so it is thankful someone tell me how to approach this problem.</div><div><br></div></div><div class=""><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">2016-05-07 5:01 GMT+09:00 Saleem Abdulrasool <span dir="ltr"><<a href="mailto:compnerd@compnerd.org" target="_blank">compnerd@compnerd.org</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><span>On Thu, May 5, 2016 at 5:26 PM, Joe Groff via swift-dev <span dir="ltr"><<a href="mailto:swift-dev@swift.org" target="_blank">swift-dev@swift.org</a>></span> wrote:<br></span><div class="gmail_extra"><div class="gmail_quote"><span><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span><br>
> On May 5, 2016, at 4:18 PM, Sangjin Han via swift-dev <<a href="mailto:swift-dev@swift.org" target="_blank">swift-dev@swift.org</a>> wrote:<br>
><br>
> Hi,<br>
><br>
> I made an experimental MSVC port. Of cause, dllimport/dllexport and the driver for linking and many other part is not implemented. But dynamic linking was possible with some trick.<br>
><br>
> I think it is useful for designing, my observation about the experimental building of libswiftCore.dll, libswiftSwiftOnoneSupport.dll and linking of Hello.exe - its source has only 'print("Hello")'.<br>
><br>
> 1) SWIFT_RUNTIME_EXPORT was not enough for dllexport.<br>
> Hello.obj needed defined in libswift*.dll<br>
> _swift_getExistentialTypeMetadata,<br>
> _TFs5printFTGSaP__9separatorSS10terminatorSS_T_,<br>
> _TMSS,<br>
> _TZvOs7Process5_argcVs5Int32,<br>
> swift_bufferAllocate, ....<br>
> Some of above are dllexported by the macro, but _T* are not. Maybe, it generated by swiftc.exe.<br>
> I used the utility 'dlltool.exe' from Cygwin/MinGW world. It extracts all symbols and generates 'allsymbol.def'.<br>
> With that .def, I could build the all-symbol-dllexported libswiftCore.dll.<br>
> (I'm hoping we can build it without this trick.)<br>
<br>
</span>The _T symbols are emitted by the Swift compiler. You should modify swiftc's IRGen to generate public symbols with LLVM's "dllexport" storage class when targeting Windows.</blockquote><div><br></div></span><div><a href="https://github.com/apple/swift/pull/2080" target="_blank">https://github.com/apple/swift/pull/2080</a> is a first cut attempt to do this.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span><font color="#888888"><br>
-Joe<br>
</font></span><span><div><div>_______________________________________________<br>
swift-dev mailing list<br>
<a href="mailto:swift-dev@swift.org" target="_blank">swift-dev@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-dev" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-dev</a><br>
</div></div></span></blockquote></div><br><br clear="all"><span><div><br></div>-- <br><div>Saleem Abdulrasool<br>compnerd (at) compnerd (dot) org</div>
</span></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div></div>