由於未解析的外部結構,使用默認的-arch:SSE編譯器標誌進行構建時,Ruby 1.9.1無法使用Visual Studio 2012(update1和2)進行構建。Visual Studio 2012爲xmm生成未解析的外部結構
cl -nologo -LD main.obj dmyext.obj msvcr110-ruby191-static.lib msvcr110-ruby191.res unicows.lib oldnames.lib user32.lib advapi32.lib shell32.lib ws2_32.lib -Femsvcr110-ruby191.dll -link -incremental:no -debug -opt:ref -opt:icf -implib:dummy.lib -def:msvcr110-ruby191.def -MAP:map-out.txt
Creating library dummy.lib and object dummy.exp
dummy.exp : error LNK2001: unresolved external symbol [email protected]
dummy.exp : error LNK2001: unresolved external symbol [email protected]
msvcr110-ruby191.dll : fatal error LNK1120: 2 unresolved externals
打開模塊定義文件,下面的寄存器數據項出現在出口部分:前面有兩個下劃線不會引起問題
[email protected] DATA
[email protected] DATA
[email protected] DATA
[email protected] DATA
前兩個項目,但最後兩個項目前面有一個下劃線負責未解決的外部事件。手動修改def文件以便它們都有兩個下劃線似乎可以解決這個問題,但我不確定這是否隱藏了問題或解決了問題。
另一種選擇是使用鏈接器標誌-force:unresolved構建,但如果實際需要未解析的外部件,則這會很危險。
解決此問題的第三個選項是使用-arch:IA32選項進行編譯,該選項不會生成SSE指令。不過,這個ruby dll也是爲x64平臺而構建的,似乎沒有辦法使用替代選項選項成功構建x64。
我的問題是:
是正常/預期XMM寄存器數據出現在模塊定義文件導出?
有沒有關於如何解決這個Win32和x64平臺的任何想法?