[TT# 1592][t] Improve test for open opcode delegation. All tests in the file pass...
[parrot.git] / examples / nci / QtHelloWorld.pir
blob365c7909ddfd17d6e831fa2f70959783d0d27598
1 # Copyright (C) 2009, Parrot Foundation.
2 # $Id$
4 =head1 NAME
6 examples/nci/QtHelloWorld.pir - Qt Example
8 =head1 SYNOPSIS
10     % ./parrot examples/nci/QtHelloWorld.pir
12 =head1 DESCRIPTION
14 Sample "Hello World" with Qt, via Parrot Native Call Interface (NCI). See
15 F<docs/pdds/pdd03_calling_conventions.pod>.
17 Qt - A cross-platform application and UI framework
18 (L<http://www.qtsoftware.com/about/news/lgpl-license-option-added-to-qt>). You'll need to build
19 F<libPQt.so> or F<PQt.dll> and install it in F<runtime/parrot/dynext> for this to
20 work, see F<examples/nci/PQt.C> for more information.
22 Note that this will either need JIT for building the NCI-functions on
23 the fly. If this is not available try adding missing signatures to
24 F<src/nci/extra_thunks.nci>, running F<tools/dev/mk_nci_thunks.pl>, and
25 rebuilding Parrot.
27 =cut
28 .sub main
30     .local pmc libpqt
31     loadlib libpqt, "libPQt"
32     if libpqt goto loaded
34   failed:
35     .local string message
36     message  = 'Install PQt.dll or libPQt.so into runtime/parrot/dynext'
37     die message
39   loaded:
40     print "Loaded\n"
42     .local pmc QApplication_new, pApp
43     dlfunc QApplication_new, libpqt, "QApplication_new", "pv"
44     pApp = QApplication_new()
46     .local pmc QLabel_new, pLabel
47     .local string caption
48     caption = "Hello, world!"
49     dlfunc QLabel_new, libpqt, "QLabel_new", "pt"
50     pLabel = QLabel_new(caption)
52     .local pmc QLabel_resize
53     dlfunc QLabel_resize, libpqt, "QLabel_resize", "vpii"
54     QLabel_resize(pLabel, 120, 30)
56     .local pmc QLabel_show
57     dlfunc QLabel_show, libpqt, "QLabel_show", "vp"
58     QLabel_show(pLabel)
60     .local pmc QApplication_exec
61     dlfunc QApplication_exec, libpqt,"QApplication_exec", "vp"
62     QApplication_exec(pApp)
64 .end
66 =head1 SEE ALSO
68 F<examples/nci/PQt.C>, F<docs/pdds/pdd03_calling_conventions.pod>.
70 =cut
72 # Local Variables:
73 #   mode: pir
74 #   fill-column: 100
75 # End:
76 # vim: expandtab shiftwidth=4 ft=pir: