我正在尝试使用LeMP为C++库生成一些C#绑定,作为其中的一部分,我需要生成一个字符串,该字符串将来自LeMP宏的一些参数组合在一起,以在DllImport EntryPoint值中使用。看一下文档,似乎concatId和stringify的组合应该可以完成这项工作,但我不能让它工作。下面是相关代码的一个稍微简化的版本:
define TypedIndexer2D($CONTAINER_TYPE, $T1, $T2)
{
replace(MethodName => concatId(Buffer, $CONTAINER_TYPE, GetExpr_, $T1, $T2));
replace(CFunction => concatId(buffer_, $CONTAINER_TYPE, _getexpr__, $T1, $T2));
[DllImport(Constants.LibName, EntryPoint = CFunction)]
public static extern IntPtr MethodName(IntPtr obj, IntPtr x, IntPtr y);
}
TypedIndexer2D(Int, Var, Var);这将发出以下内容:
[DllImport(Constants.LibName, EntryPoint = buffer_Int_getexpr__VarVar)]
public static extern IntPtr BufferIntGetExpr_VarVar(IntPtr obj, IntPtr x, IntPtr y);但是,我需要这样:
[DllImport(Constants.LibName, EntryPoint = "buffer_Int_getexpr__VarVar")]
public static extern IntPtr BufferIntGetExpr_VarVar(IntPtr obj, IntPtr x, IntPtr y);(请注意引用的EntryPoint)。
我曾想过它会是这样的:
replace(CFunction => stringify(concatId(buffer_, $CONTAINER_TYPE, _getexpr__, $T1, $T2)));然而,这只会发出以下内容:
[DllImport(Constants.LibName, EntryPoint = "concatId(buffer_, Int, _getexpr__, Var, Var)")]我怎样才能说服LeMP生成我需要的字符串呢?谢谢!
https://stackoverflow.com/questions/51316725
复制相似问题