@@ -9,7 +9,9 @@ struct lbt_library_info_t
99 suffix:: Cstring
1010 active_forwards:: Ptr{UInt8}
1111 interface:: Int32
12+ complex_retstyle:: Int32
1213 f2c:: Int32
14+ cblas:: Int32
1315end
1416const LBT_INTERFACE_LP64 = 32
1517const LBT_INTERFACE_ILP64 = 64
@@ -31,13 +33,35 @@ const LBT_F2C_MAP = Dict(
3133)
3234const LBT_INV_F2C_MAP = Dict (v => k for (k, v) in LBT_F2C_MAP)
3335
36+ const LBT_COMPLEX_RETSTYLE_NORMAL = 0
37+ const LBT_COMPLEX_RETSTYLE_ARGUMENT = 1
38+ const LBT_COMPLEX_RETSTYLE_UNKNOWN = - 1
39+ const LBT_COMPLEX_RETSTYLE_MAP = Dict (
40+ LBT_COMPLEX_RETSTYLE_NORMAL => :normal ,
41+ LBT_COMPLEX_RETSTYLE_ARGUMENT => :argument ,
42+ LBT_COMPLEX_RETSTYLE_UNKNOWN => :unknown ,
43+ )
44+ const LBT_INV_COMPLEX_RETSTYLE_MAP = Dict (v => k for (k, v) in LBT_COMPLEX_RETSTYLE_MAP)
45+
46+ const LBT_CBLAS_CONFORMANT = 0
47+ const LBT_CBLAS_DIVERGENT = 1
48+ const LBT_CBLAS_UNKNOWN = - 1
49+ const LBT_CBLAS_MAP = Dict (
50+ LBT_CBLAS_CONFORMANT => :conformant ,
51+ LBT_CBLAS_DIVERGENT => :divergent ,
52+ LBT_CBLAS_UNKNOWN => :unknown ,
53+ )
54+ const LBT_INV_CBLAS_MAP = Dict (v => k for (k, v) in LBT_CBLAS_MAP)
55+
3456struct LBTLibraryInfo
3557 libname:: String
3658 handle:: Ptr{Cvoid}
3759 suffix:: String
3860 active_forwards:: Vector{UInt8}
3961 interface:: Symbol
62+ complex_retstyle:: Symbol
4063 f2c:: Symbol
64+ cblas:: Symbol
4165
4266 function LBTLibraryInfo (lib_info:: lbt_library_info_t , num_exported_symbols:: UInt32 )
4367 return new (
@@ -46,7 +70,9 @@ struct LBTLibraryInfo
4670 unsafe_string (lib_info. suffix),
4771 unsafe_wrap (Vector{UInt8}, lib_info. active_forwards, div (num_exported_symbols,8 )+ 1 ),
4872 LBT_INTERFACE_MAP[lib_info. interface],
73+ LBT_COMPLEX_RETSTYLE_MAP[lib_info. complex_retstyle],
4974 LBT_F2C_MAP[lib_info. f2c],
75+ LBT_CBLAS_MAP[lib_info. cblas],
5076 )
5177 end
5278end
@@ -112,7 +138,9 @@ function Base.show(io::IO, mime::MIME{Symbol("text/plain")}, lbt::LBTLibraryInfo
112138 summary (io, lbt); println (io)
113139 println (io, " ├ Library: " , basename (lbt. libname))
114140 println (io, " ├ Interface: " , lbt. interface)
115- print (io, " └ F2C: " , lbt. f2c)
141+ print (io, " ├ Complex return style: " , lbt. complex_retstyle)
142+ print (io, " ├ F2C: " , lbt. f2c)
143+ print (io, " └ CBLAS: " , lbt. cblas)
116144end
117145
118146function Base. show (io:: IO , lbt:: LBTConfig )
@@ -210,20 +238,29 @@ end
210238# # NOTE: Manually setting forwards is referred to as the 'footgun API'. It allows truly
211239# # bizarre and complex setups to be created. If you run into strange errors while using
212240# # it, the first thing you should ask yourself is whether you've set things up properly.
213- function lbt_set_forward (symbol_name, addr, interface, f2c = LBT_F2C_PLAIN; verbose:: Bool = false )
241+ function lbt_set_forward (symbol_name, addr, interface,
242+ complex_retstyle = LBT_COMPLEX_RETSTYLE_NORMAL,
243+ f2c = LBT_F2C_PLAIN; verbose:: Bool = false )
214244 return ccall (
215245 (:lbt_set_forward , libblastrampoline),
216246 Int32,
217- (Cstring, Ptr{Cvoid}, Int32, Int32, Int32),
247+ (Cstring, Ptr{Cvoid}, Int32, Int32, Int32, Int32 ),
218248 string (symbol_name),
219249 addr,
220250 Int32 (interface),
251+ Int32 (complex_retstyle),
221252 Int32 (f2c),
222253 verbose ? Int32 (1 ) : Int32 (0 ),
223254 )
224255end
225- function lbt_set_forward (symbol_name, addr, interface:: Symbol , f2c:: Symbol = :plain ; kwargs... )
226- return lbt_set_forward (symbol_name, addr, LBT_INV_INTERFACE_MAP[interface], LBT_INV_F2C_MAP[f2c]; kwargs... )
256+ function lbt_set_forward (symbol_name, addr, interface:: Symbol ,
257+ complex_retstyle:: Symbol = :normal ,
258+ f2c:: Symbol = :plain ; kwargs... )
259+ return lbt_set_forward (symbol_name, addr,
260+ LBT_INV_INTERFACE_MAP[interface],
261+ LBT_INV_COMPLEX_RETSTYLE_MAP[complex_retstyle],
262+ LBT_INV_F2C_MAP[f2c];
263+ kwargs... )
227264end
228265
229266function lbt_get_forward (symbol_name, interface, f2c = LBT_F2C_PLAIN)
0 commit comments