File tree 1 file changed +10
-2
lines changed
1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -138,7 +138,11 @@ fn build_with_cmake() {
138
138
139
139
// Lazymio(@wtdcode): Dynamic link may break. See: https://github.com/rust-lang/cargo/issues/5077
140
140
if cfg ! ( feature = "dynamic_linkage" ) {
141
- println ! ( "cargo:rustc-link-lib=dylib=unicorn" ) ;
141
+ if compiler. is_like_msvc ( ) {
142
+ println ! ( "cargo:rustc-link-lib=dylib=unicorn-import" ) ;
143
+ } else {
144
+ println ! ( "cargo:rustc-link-lib=dylib=unicorn" ) ;
145
+ }
142
146
} else {
143
147
println ! ( "cargo:rustc-link-lib=static=unicorn" ) ;
144
148
}
@@ -159,7 +163,11 @@ fn main() {
159
163
println ! ( "cargo:rustc-link-search=native={}" , dir. to_str( ) . unwrap( ) ) ;
160
164
}
161
165
if cfg ! ( feature = "dynamic_linkage" ) {
162
- println ! ( "cargo:rustc-link-lib=dylib=unicorn" ) ;
166
+ if cc:: Build :: new ( ) . get_compiler ( ) . is_like_msvc ( ) {
167
+ println ! ( "cargo:rustc-link-lib=dylib=unicorn-import" ) ;
168
+ } else {
169
+ println ! ( "cargo:rustc-link-lib=dylib=unicorn" ) ;
170
+ }
163
171
} else {
164
172
println ! ( "cargo:rustc-link-arg=-Wl,-allow-multiple-definition" ) ;
165
173
println ! ( "cargo:rustc-link-lib=static=unicorn" ) ;
You can’t perform that action at this time.
0 commit comments