annotate lua/luadc/test.lua @ 54:918dab7a6606

- added callback support (comes with some bigger refactoring) - allow CPython's Py{CObject,Capsule} to be used as 'p'ointers
author Tassilo Philipp
date Tue, 02 Feb 2021 20:42:02 +0100
parents 0cfcc391201f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
1 require "package"
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
2 pf = package.loadlib("luadc","luadc_open")
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
3 pf()
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
4
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
5 print(dc.C_DEFAULT)
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
6 print(dc.C_X86_WIN32_STD)
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
7
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
8 dc.mode(dc.C_DEFAULT)
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
9
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
10 clib = dc.load("msvcrt")
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
11 f = dc.find(clib,"sqrt")
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
12 x = dc.call(f,"d)d",144)
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
13 print(x)
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
14
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
15
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
16 dc.mode(dc.C_X86_WIN32_STD)
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
17
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
18 user32 = dc.load("user32")
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
19 f = dc.find(user32,"MessageBoxA")
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
20 x = dc.call(f,"iSSi)v", 0, "Hello", "World", 0)
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
21
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
22