how to call ats function in c codes under dats file
41 views
Skip to first unread message
jin
unread,
Jun 23, 2025, 10:01:47 PMJun 23
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ats-lang-users
i'm using ats2, and i want to use pthread, i want to call ats funtion in c code, i tried the extern fun xxx="ext#xxx", but seems like c function cant use the xxx to run the ats function. any way to export a ats function with a global name which c can use?
jin
unread,
Jun 23, 2025, 10:28:27 PMJun 23
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ats-lang-users
fn exportToCTest (i:int):int=i+1
extern fun exportToCTest(i:int):int="ext#exportToCTest"
%{$ int callAtsTest(int a) { return exportToCTest(0); } %}
here is my test code, cant run
jin
unread,
Jun 23, 2025, 10:35:26 PMJun 23
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ats-lang-users
extern fun exportToCTest(i:int):int="ext#exportToCTest"
implement exportToCTest (i)=i+1
%{$ int callAtsTest(int a) { return exportToCTest(0); } %}
sorry, i forgot to use implement , its working now