试图找到客户端应用程序无法在.so库中找到导出函数的原因。我做了
public static <A,B> ArrayList<ArrayList<Pair<A,B>>> stratifiedSplit(
ArrayList<Pair<A,B>> dataset,
int k
) {
// create a (hash?)map for the strata.
// In this map, you want to collect rows in separate
// lists, depending on their label:
HashMap<B, ArrayList<Pair<A,B>>> strata = ...;
// (Check whether your collection library of choice
// provides a `groupBy` or a `groupingBy` of some sort.
// In C#, this might help:
// https://msdn.microsoft.com/en-us/library/bb534304(v=vs.110).aspx )
// In your concrete case,
// your map should look something like this:
// {
// false -> [
// ([5, 6, 7, 8], false),
// ([5, 6, 7, 8], false),
// ([5, 6, 7, 8], false),
// ([5, 6, 7, 8], false),
// ([5, 6, 7, 8], false),
// ([5, 6, 7, 8], false)
// ],
// true -> [
// ([5, 6, 7, 8], true),
// ([1, 2, 3, 4], true)
// ]
// }
// where `{}`=map, `[]`=list/array, `()`=tuple/pair.
// Now you generate `k` lists to hold the result.
// For each stratum, you call the ordinary non-stratified
// `split` method, and append the `k` pieces returned by
// this method to the `k` result lists.
// In the end, you again shuffle each of the `k` result
// lists (so that the labels aren't sorted in the end)
// return `k` result lists.
}
得到答案:
nm -D libmylib.so |grep " T " |grep aaa
如果我查看客户端应用程序可见的其他函数,我的开头输出时没有T _Z20aaasPP8CashInfoPiS1_S2_S2_PcS3_
符号,而T _Z20
就是垃圾邮件。
PP8CashInfoPiS1_S2_S2_PcS3_
是什么意思以及为什么我的新功能对客户端应用程序不可见?