summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2022-06-01 17:37:07 -0700
committerGitHub <noreply@github.com>2022-06-01 17:37:07 -0700
commit17e3b88b541ed7f45d575f0f9caaa808cd0a6619 (patch)
treeefacd5d4bf6381a5adf8055daa28f91ddc048a76 /examples
parentfa10f7dc23f8b93c0f9ef3fb5477871a20aaa974 (diff)
New language feature: basic error handling. (#2253)
* New language feature: basic error handling. * Fix. * Fix `tryCall` encoding according to code review. Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/heterogeneous-hello-world/main.slang8
1 files changed, 3 insertions, 5 deletions
diff --git a/examples/heterogeneous-hello-world/main.slang b/examples/heterogeneous-hello-world/main.slang
index 2e65c7149..2a9c1eaf1 100644
--- a/examples/heterogeneous-hello-world/main.slang
+++ b/examples/heterogeneous-hello-world/main.slang
@@ -9,20 +9,18 @@ int MessageBoxA(Ptr<void> hwnd, String text, String caption, uint flags);
[COM]
interface IObject
{
- int getValue(int value);
+ int getValue(int value) throws int;
}
[DllImport("test-com")]
IObject createObject();
-public __extern_cpp int main()
+public __extern_cpp void main() throws int
{
//writeln("hello world");
//MessageBoxA(nullptr, "hello world!", "example", 0);
IObject object = createObject();
- int rs = object.getValue(2);
-
- return 0;
+ int rs = try object.getValue(2);
} \ No newline at end of file