summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2022-04-12 15:23:53 -0700
committerGitHub <noreply@github.com>2022-04-12 15:23:53 -0700
commit65c2e7f1ccc6cdb5daec343c7e32b4a9dc463ae4 (patch)
treeb13a93f5fa621a50ce3c100f018730c882ca3e9c /examples
parent89560d62f3fb42e0f76cbae76c23eac437b65eba (diff)
Support `[DllImport]` (#2181)
* Support `[DllImport]` * Fix. * Fix. * Fix array type emit in cpp. * Fix. * Fix. * Fix Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/heterogeneous-hello-world/main.slang4
1 files changed, 4 insertions, 0 deletions
diff --git a/examples/heterogeneous-hello-world/main.slang b/examples/heterogeneous-hello-world/main.slang
index 08b4b7f39..90f39fff7 100644
--- a/examples/heterogeneous-hello-world/main.slang
+++ b/examples/heterogeneous-hello-world/main.slang
@@ -3,8 +3,12 @@
__target_intrinsic(cpp, "printf(\"%s\", ($0).getBuffer())")
public void writeln(String text);
+[DllImport("User32")]
+int MessageBoxA(Ptr<void> hwnd, String text, String caption, uint flags);
+
public __extern_cpp int main()
{
writeln("hello world");
+ MessageBoxA(nullptr, "hello world!", "example", 0);
return 0;
} \ No newline at end of file