changeset 37:8c8f848131c6

- version bump - better doc - made calling convention mode reset by default, as only way to specify convention used is via signature string
author Tassilo Philipp
date Mon, 13 Apr 2020 20:08:54 +0200
parents b84064293541
children 9943c30ee2aa
files python/pydc/README.txt python/pydc/pydcext.c python/pydc/setup.py
diffstat 3 files changed, 33 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/python/pydc/README.txt	Mon Apr 13 16:28:47 2020 +0200
+++ b/python/pydc/README.txt	Mon Apr 13 20:08:54 2020 +0200
@@ -10,6 +10,7 @@
 Apr 11, 2020: support for getting loaded library path
 Apr 12, 2020: breaking change: restrict 'Z' conversions to immutable types
               and 'p' to mutable types (and handles)
+Apr 13, 2020: added signature char support to specify calling conventions
 
 
 BUILD/INSTALLATION
@@ -28,11 +29,17 @@
 API
 ===
 
-libhandle = load(libpath)
+libhandle = load(libpath)               # if path == None => handle to running process
+libpath   = get_path(libhandle)         # if handle == None => path to executable
 funcptr   = find(libhandle, symbolname)
 call(funcptr, signature, ...)
 free(libhandle)
 
+Note that there are no functions to set the calling convention mode. However,
+it can be set using the signature.
+Not specifying any calling convention in the signature string will use the
+platform's default one.
+
 
 SIGNATURE FORMAT
 ================
@@ -73,6 +80,7 @@
       | -                               | bytes (PyBytes)               ! | const char* (UTF-8 for unicode) | int (PyString)                       | str (PyUnicode)
       | bytearray (PyByteArray)       ! | bytearray (PyByteArray)       ! | const char* (UTF-8 for unicode) | int (PyString)                       | str (PyUnicode)
 
+  Annotations:
   # converted to 1 if True and 0 otherwise
   @ converted to False if 0 and True otherwise
   % range/length checked
@@ -82,8 +90,24 @@
   ! immutable buffer when passed to C, as strings (in any form) are considered objects, not buffers
 
 
-  also supported are specifying calling convention mode switches using
-  '_'-prefixed signature characters; consult the dyncall docs for a list
+  Also supported are specifying calling convention switches using '_'-prefixed
+  signature characters:
+
+  SIG | DESCRIPTION
+  ----+-----------------------------------------------------------------------------------------------------------
+  '_' | prefix indicating that next signature character specifies calling convention; char is one of the following
+  ':' | platform's default calling convention
+  'e' | vararg function
+  '.' | vararg function's variadic/ellipsis part (...), to be specified before first vararg
+  'c' | only on x86: cdecl
+  's' | only on x86: stdcall
+  'F' | only on x86: fastcall (MS)
+  'f' | only on x86: fastcall (GNU)
+  '+' | only on x86: thiscall (MS)
+  '#' | only on x86: thiscall (GNU)
+  'A' | only on ARM: ARM mode
+  'a' | only on ARM: THUMB mode
+  '$' | syscall
 
 
 TODO
--- a/python/pydc/pydcext.c	Mon Apr 13 16:28:47 2020 +0200
+++ b/python/pydc/pydcext.c	Mon Apr 13 20:08:54 2020 +0200
@@ -193,6 +193,7 @@
 	ts  = PyTuple_Size(args);
 
 	dcReset(gpCall);
+	dcMode(gpCall, DC_CALL_C_DEFAULT);
 
 	for (ch = *ptr; ch != '\0' && ch != ')'; ch = *++ptr)
 	{
--- a/python/pydc/setup.py	Mon Apr 13 16:28:47 2020 +0200
+++ b/python/pydc/setup.py	Mon Apr 13 20:08:54 2020 +0200
@@ -7,11 +7,11 @@
 
 setup(
   name             = 'pydc'
-, version          = '1.1.1'
-, author           = 'Daniel Adler'
-, author_email     = 'dadler@dyncall.org'
-, maintainer       = 'Daniel Adler'
-, maintainer_email = 'dadler@dyncall.org'
+, version          = '1.1.2'
+, author           = 'Daniel Adler, Tassilo Philipp'
+, author_email     = 'dadler@dyncall.org, tphilip@dyncall.org'
+, maintainer       = 'Daniel Adler, Tassilo Philipp'
+, maintainer_email = 'dadler@dyncall.org, tphilip@dyncall.org'
 , url              = 'https://www.dyncall.org'
 , download_url     = 'https://www.dyncall.org/download'
 , classifiers      = []