Add test showing c linkage working fine [#16]

This commit is contained in:
Jason Turner
2012-07-16 22:10:40 -06:00
parent f0016d978a
commit 441cdf0935
2 changed files with 24 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
#include <chaiscript/chaiscript.hpp>
extern "C"
{
int dosomething(int i)
{
return i % 2;
}
}
int main()
{
chaiscript::ChaiScript chai;
chai.add(chaiscript::fun(&dosomething), "dosomething");
return chai.eval<int>("dosomething(101)") == 101 % 2?EXIT_SUCCESS:EXIT_FAILURE;
}