如何将实例化的泛型函数导出到C
我创建了一个具有导出和约定方面的通用函数。然后我实例化了这个函数,但它最终在我的库中带有 'r' 后缀。为什么会发生这种情况,我该如何解决?
例如:
generic
I : int;
function Test_Generic return int
with Export => True, Convention => C;
function Test_Generic return int is
begin
return I;
end;
function Test is new Test_Generic (I => 5);
-- In library this function has name testr
回答
一个更简单的答案是将所有方面移动到通用实例,但还要添加一个 External_Name 方面:
function Test is new Test_Generic (I => 5)
with Export, Convention => C, External_Name => "test";
我不明白为什么这里需要 External_Name,而 Export 是不够的。