NO

Author Topic: Long list of errors from mmreg.h file  (Read 1050 times)

Offline wtrC11pgx

  • Member
  • *
  • Posts: 4
Long list of errors from mmreg.h file
« on: April 03, 2018, 12:17:01 am »
I just installed Pelles C and I'm compiling a C dll on Windows 7.  Using Pelles IDE, I selected the default Windows DLL project option.  Here are the default command line options:

-std:C11 -Tx64-coff -Ot -Ob1 -fp:precise -W1 -Gd -Ze

When I compile this project, I get the following long list of errors from mmreg.h, which is an include file from the Pelles install.  Since this include file is supplied, I don't know why I get these errors.  They all appear to be related to the header file itself. 

Building C_DLL_Code.obj.
C:\Program Files\PellesC\Include\Win\mmreg.h(1915): error #2078: Invalid struct field declarations.
C:\Program Files\PellesC\Include\Win\mmreg.h(1915): error #2001: Syntax error: expected '}' but found 'WORD'.
C:\Program Files\PellesC\Include\Win\mmreg.h(1915): warning #2014: Empty declaration.
C:\Program Files\PellesC\Include\Win\mmreg.h(1916): warning #2099: Missing type specifier; assuming 'int'.
C:\Program Files\PellesC\Include\Win\mmreg.h(1916): error #2001: Syntax error: expected ';' but found 'nChannels'.
C:\Program Files\PellesC\Include\Win\mmreg.h(1916): warning #2099: Missing type specifier; assuming 'int'.
C:\Program Files\PellesC\Include\Win\mmreg.h(1917): warning #2099: Missing type specifier; assuming 'int'.
C:\Program Files\PellesC\Include\Win\mmreg.h(1917): error #2001: Syntax error: expected ';' but found 'nSamplesPerSec'.
C:\Program Files\PellesC\Include\Win\mmreg.h(1917): error #2048: Undeclared identifier 'nSamplesPerSec' (did you mean 'wrapperfunc'?).
C:\Program Files\PellesC\Include\Win\mmreg.h(1917): error #2014: Empty declaration.
C:\Program Files\PellesC\Include\Win\mmreg.h(1918): warning #2099: Missing type specifier; assuming 'int'.
C:\Program Files\PellesC\Include\Win\mmreg.h(1918): error #2001: Syntax error: expected ';' but found 'nAvgBytesPerSec'.
C:\Program Files\PellesC\Include\Win\mmreg.h(1918): error #2048: Undeclared identifier 'nAvgBytesPerSec' (did you mean '_PyBytesWriter'?).
C:\Program Files\PellesC\Include\Win\mmreg.h(1918): warning #2014: Empty declaration.
C:\Program Files\PellesC\Include\Win\mmreg.h(1919): warning #2099: Missing type specifier; assuming 'int'.
C:\Program Files\PellesC\Include\Win\mmreg.h(1919): error #2001: Syntax error: expected ';' but found 'nBlockAlign'.
C:\Program Files\PellesC\Include\Win\mmreg.h(1919): warning #2099: Missing type specifier; assuming 'int'.
C:\Program Files\PellesC\Include\Win\mmreg.h(1920): error #2156: Unrecognized declaration.
C:\Program Files\PellesC\Include\Win\mmreg.h(1920): warning #2099: Missing type specifier; assuming 'int'.
C:\Program Files\PellesC\Include\Win\mmreg.h(1923): error #2078: Invalid struct field declarations.
C:\Program Files\PellesC\Include\Win\mmreg.h(1923): error #2001: Syntax error: expected '}' but found 'WAVEFORMAT'.
C:\Program Files\PellesC\Include\Win\mmreg.h(1923): warning #2014: Empty declaration.
C:\Program Files\PellesC\Include\Win\mmreg.h(1924): warning #2099: Missing type specifier; assuming 'int'.
C:\Program Files\PellesC\Include\Win\mmreg.h(1924): error #2001: Syntax error: expected ';' but found 'wBitsPerSample'.
C:\Program Files\PellesC\Include\Win\mmreg.h(1924): warning #2099: Missing type specifier; assuming 'int'.
C:\Program Files\PellesC\Include\Win\mmreg.h(1925): error #2156: Unrecognized declaration.
C:\Program Files\PellesC\Include\Win\mmreg.h(1925): warning #2099: Missing type specifier; assuming 'int'.
C:\Program Files\PellesC\Include\Win\mmreg.h(1932): error #2078: Invalid struct field declarations.
C:\Program Files\PellesC\Include\Win\mmreg.h(1932): error #2001: Syntax error: expected '}' but found 'WORD'.
C:\Program Files\PellesC\Include\Win\mmreg.h(1932): warning #2014: Empty declaration.
C:\Program Files\PellesC\Include\Win\mmreg.h(1933): warning #2099: Missing type specifier; assuming 'int'.
C:\Program Files\PellesC\Include\Win\mmreg.h(1933): error #2001: Syntax error: expected ';' but found 'nChannels'.
C:\Program Files\PellesC\Include\Win\mmreg.h(1933): warning #2099: Missing type specifier; assuming 'int'.
C:\Program Files\PellesC\Include\Win\mmreg.h(1934): warning #2099: Missing type specifier; assuming 'int'.
C:\Program Files\PellesC\Include\Win\mmreg.h(1934): error #2001: Syntax error: expected ';' but found 'nSamplesPerSec'.
C:\Program Files\PellesC\Include\Win\mmreg.h(1934): error #2048: Undeclared identifier 'nSamplesPerSec' (did you mean 'wrapperfunc'?).
C:\Program Files\PellesC\Include\Win\mmreg.h(1934): error #2014: Empty declaration.
C:\Program Files\PellesC\Include\Win\mmreg.h(1935): warning #2099: Missing type specifier; assuming 'int'.
C:\Program Files\PellesC\Include\Win\mmreg.h(1935): error #2001: Syntax error: expected ';' but found 'nAvgBytesPerSec'.
C:\Program Files\PellesC\Include\Win\mmreg.h(1935): error #2048: Undeclared identifier 'nAvgBytesPerSec' (did you mean '_PyBytesWriter'?).
C:\Program Files\PellesC\Include\Win\mmreg.h(1935): warning #2014: Empty declaration.
C:\Program Files\PellesC\Include\Win\mmreg.h(1936): warning #2099: Missing type specifier; assuming 'int'.
C:\Program Files\PellesC\Include\Win\mmreg.h(1936): error #2001: Syntax error: expected ';' but found 'nBlockAlign'.
C:\Program Files\PellesC\Include\Win\mmreg.h(1936): warning #2099: Missing type specifier; assuming 'int'.
C:\Program Files\PellesC\Include\Win\mmreg.h(1937): warning #2099: Missing type specifier; assuming 'int'.
C:\Program Files\PellesC\Include\Win\mmreg.h(1937): error #2001: Syntax error: expected ';' but found 'wBitsPerSample'.
C:\Program Files\PellesC\Include\Win\mmreg.h(1937): warning #2099: Missing type specifier; assuming 'int'.
C:\Program Files\PellesC\Include\Win\mmreg.h(1938): warning #2099: Missing type specifier; assuming 'int'.
C:\Program Files\PellesC\Include\Win\mmreg.h(1938): error #2001: Syntax error: expected ';' but found 'cbSize'.
C:\Program Files\PellesC\Include\Win\mmreg.h(1938): warning #2099: Missing type specifier; assuming 'int'.
C:\Program Files\PellesC\Include\Win\mmreg.h(1939): error #2156: Unrecognized declaration.
C:\Program Files\PellesC\Include\Win\mmreg.h(1939): warning #2099: Missing type specifier; assuming 'int'.
C:\Program Files\PellesC\Include\Win\mmreg.h(2002): error #2078: Invalid struct field declarations.
C:\Program Files\PellesC\Include\Win\mmreg.h(2002): error #2001: Syntax error: expected '}' but found 'WAVEFORMATEX'.
C:\Program Files\PellesC\Include\Win\mmreg.h(2002): warning #2014: Empty declaration.
C:\Program Files\PellesC\Include\Win\mmreg.h(2003): warning #2099: Missing type specifier; assuming 'int'.
C:\Program Files\PellesC\Include\Win\mmreg.h(2003): error #2001: Syntax error: expected ';' but found 'wSamplesPerBlock'.
C:\Program Files\PellesC\Include\Win\mmreg.h(2003): error #2048: Undeclared identifier 'wSamplesPerBlock' (did you mean 'wrapperfunc'?).
C:\Program Files\PellesC\Include\Win\mmreg.h(2003): error #2014: Empty declaration.
C:\Program Files\PellesC\Include\Win\mmreg.h(2004): warning #2099: Missing type specifier; assuming 'int'.
C:\Program Files\PellesC\Include\Win\mmreg.h(2004): error #2001: Syntax error: expected ';' but found 'wNumCoef'.
C:\Program Files\PellesC\Include\Win\mmreg.h(2004): warning #2099: Missing type specifier; assuming 'int'.
C:\Program Files\PellesC\Include\Win\mmreg.h(2010): error #2156: Unrecognized declaration.
C:\Program Files\PellesC\Include\Win\mmreg.h(2010): warning #2099: Missing type specifier; assuming 'int'.
C:\Program Files\PellesC\Include\Win\mmreg.h(2013): error #2078: Invalid struct field declarations.
C:\Program Files\PellesC\Include\Win\mmreg.h(2013): error #2001: Syntax error: expected '}' but found 'WAVEFORMATEX'.
C:\Program Files\PellesC\Include\Win\mmreg.h(2013): warning #2014: Empty declaration.
C:\Program Files\PellesC\Include\Win\mmreg.h(2014): warning #2099: Missing type specifier; assuming 'int'.
C:\Program Files\PellesC\Include\Win\mmreg.h(2014): error #2001: Syntax error: expected ';' but found 'wSamplesPerBlock'.
C:\Program Files\PellesC\Include\Win\mmreg.h(2014): error #2048: Undeclared identifier 'wSamplesPerBlock' (did you mean 'wrapperfunc'?).
C:\Program Files\PellesC\Include\Win\mmreg.h(2014): error #2014: Empty declaration.
C:\Program Files\PellesC\Include\Win\mmreg.h(2015): error #2156: Unrecognized declaration.
C:\Program Files\PellesC\Include\Win\mmreg.h(2015): warning #2099: Missing type specifier; assuming 'int'.
C:\Program Files\PellesC\Include\Win\mmreg.h(2018): error #2078: Invalid struct field declarations.
C:\Program Files\PellesC\Include\Win\mmreg.h(2018): error #2001: Syntax error: expected '}' but found 'WAVEFORMATEX'.
C:\Program Files\PellesC\Include\Win\mmreg.h(2018): warning #2014: Empty declaration.
C:\Program Files\PellesC\Include\Win\mmreg.h(2019): warning #2099: Missing type specifier; assuming 'int'.
C:\Program Files\PellesC\Include\Win\mmreg.h(2019): error #2001: Syntax error: expected ';' but found 'wSamplesPerBlock'.
C:\Program Files\PellesC\Include\Win\mmreg.h(2019): error #2048: Undeclared identifier 'wSamplesPerBlock' (did you mean 'wrapperfunc'?).
C:\Program Files\PellesC\Include\Win\mmreg.h(2019): error #2014: Empty declaration.
C:\Program Files\PellesC\Include\Win\mmreg.h(2020): error #2156: Unrecognized declaration.
C:\Program Files\PellesC\Include\Win\mmreg.h(2020): warning #2099: Missing type specifier; assuming 'int'.
C:\Program Files\PellesC\Include\Win\mmreg.h(2023): error #2078: Invalid struct field declarations.
C:\Program Files\PellesC\Include\Win\mmreg.h(2023): error #2001: Syntax error: expected '}' but found 'WAVEFORMATEX'.
C:\Program Files\PellesC\Include\Win\mmreg.h(2023): warning #2014: Empty declaration.
C:\Program Files\PellesC\Include\Win\mmreg.h(2024): warning #2099: Missing type specifier; assuming 'int'.
C:\Program Files\PellesC\Include\Win\mmreg.h(2024): error #2001: Syntax error: expected ';' but found 'wRevision'.
C:\Program Files\PellesC\Include\Win\mmreg.h(2024): warning #2099: Missing type specifier; assuming 'int'.
C:\Program Files\PellesC\Include\Win\mmreg.h(2025): error #2156: Unrecognized declaration.
C:\Program Files\PellesC\Include\Win\mmreg.h(2025): warning #2099: Missing type specifier; assuming 'int'.
C:\Program Files\PellesC\Include\Win\mmreg.h(2028): error #2078: Invalid struct field declarations.
C:\Program Files\PellesC\Include\Win\mmreg.h(2028): error #2001: Syntax error: expected '}' but found 'WAVEFORMATEX'.
C:\Program Files\PellesC\Include\Win\mmreg.h(2028): warning #2014: Empty declaration.
C:\Program Files\PellesC\Include\Win\mmreg.h(2029): warning #2099: Missing type specifier; assuming 'int'.
C:\Program Files\PellesC\Include\Win\mmreg.h(2029): error #2001: Syntax error: expected ';' but found 'wRevision'.
C:\Program Files\PellesC\Include\Win\mmreg.h(2029): warning #2099: Missing type specifier; assuming 'int'.
C:\Program Files\PellesC\Include\Win\mmreg.h(2030): error #2156: Unrecognized declaration.
C:\Program Files\PellesC\Include\Win\mmreg.h(2030): warning #2099: Missing type specifier; assuming 'int'.
C:\Program Files\PellesC\Include\Win\mmreg.h(2033): error #2078: Invalid struct field declarations.
C:\Program Files\PellesC\Include\Win\mmreg.h(2033): error #2001: Syntax error: expected '}' but found 'WAVEFORMATEX'.
C:\Program Files\PellesC\Include\Win\mmreg.h(2033): warning #2014: Empty declaration.
C:\Program Files\PellesC\Include\Win\mmreg.h(2034): warning #2099: Missing type specifier; assuming 'int'.
C:\Program Files\PellesC\Include\Win\mmreg.h(2034): error #2001: Syntax error: expected ';' but found 'cbExtraSize'.
C:\Program Files\PellesC\Include\Win\mmreg.h(2034): warning #2099: Missing type specifier; assuming 'int'.
C:\Program Files\PellesC\Include\Win\mmreg.h(2035): warning #2099: Missing type specifier; assuming 'int'.
C:\Program Files\PellesC\Include\Win\mmreg.h(2035): error #2001: Syntax error: expected ';' but found 'nAuxBlockSize'.
C:\Program Files\PellesC\Include\Win\mmreg.h(2035): warning #2099: Missing type specifier; assuming 'int'.
C:\Program Files\PellesC\Include\Win\mmreg.h(2036): error #2156: Unrecognized declaration.
C:\Program Files\PellesC\Include\Win\mmreg.h(2036): warning #2099: Missing type specifier; assuming 'int'.
C:\Program Files\PellesC\Include\Win\mmreg.h(2039): error #2078: Invalid struct field declarations.
C:\Program Files\PellesC\Include\Win\mmreg.h(2039): error #2001: Syntax error: expected '}' but found 'WAVEFORMATEX'.
C:\Program Files\PellesC\Include\Win\mmreg.h(2039): warning #2014: Empty declaration.
C:\Program Files\PellesC\Include\Win\mmreg.h(2040): error #2156: Unrecognized declaration.
C:\Program Files\PellesC\Include\Win\mmreg.h(2040): warning #2099: Missing type specifier; assuming 'int'.
C:\Program Files\PellesC\Include\Win\mmreg.h(2043): error #2078: Invalid struct field declarations.
C:\Program Files\PellesC\Include\Win\mmreg.h(2043): error #2001: Syntax error: expected '}' but found 'WAVEFORMATEX'.
C:\Program Files\PellesC\Include\Win\mmreg.h(2043): warning #2014: Empty declaration.
C:\Program Files\PellesC\Include\Win\mmreg.h(2044): error #2156: Unrecognized declaration.
C:\Program Files\PellesC\Include\Win\mmreg.h(2044): warning #2099: Missing type specifier; assuming 'int'.
C:\Program Files\PellesC\Include\Win\mmreg.h(2047): error #2078: Invalid struct field declarations.
C:\Program Files\PellesC\Include\Win\mmreg.h(2047): error #2001: Syntax error: expected '}' but found 'WAVEFORMATEX'.
C:\Program Files\PellesC\Include\Win\mmreg.h(2047): warning #2014: Empty declaration.
C:\Program Files\PellesC\Include\Win\mmreg.h(2048): error #2156: Unrecognized declaration.
C:\Program Files\PellesC\Include\Win\mmreg.h(2048): warning #2099: Missing type specifier; assuming 'int'.
C:\Program Files\PellesC\Include\Win\mmreg.h(2051): error #2078: Invalid struct field declarations.
C:\Program Files\PellesC\Include\Win\mmreg.h(2051): error #2001: Syntax error: expected '}' but found 'WAVEFORMATEX'.
C:\Program Files\PellesC\Include\Win\mmreg.h(2051): warning #2014: Empty declaration.
C:\Program Files\PellesC\Include\Win\mmreg.h(2052): error #2156: Unrecognized declaration.
C:\Program Files\PellesC\Include\Win\mmreg.h(2052): warning #2099: Missing type specifier; assuming 'int'.
C:\Program Files\PellesC\Include\Win\mmreg.h(2055): error #2078: Invalid struct field declarations.
C:\Program Files\PellesC\Include\Win\mmreg.h(2055): error #2001: Syntax error: expected '}' but found 'WAVEFORMATEX'.
C:\Program Files\PellesC\Include\Win\mmreg.h(2055): warning #2014: Empty declaration.
C:\Program Files\PellesC\Include\Win\mmreg.h(2056): warning #2099: Missing type specifier; assuming 'int'.
C:\Program Files\PellesC\Include\Win\mmreg.h(2056): error #2001: Syntax error: expected ';' but found 'wCompType'.
C:\Program Files\PellesC\Include\Win\mmreg.h(2056): warning #2099: Missing type specifier; assuming 'int'.
C:\Program Files\PellesC\Include\Win\mmreg.h(2057): error #2156: Unrecognized declaration.
C:\Program Files\PellesC\Include\Win\mmreg.h(2057): warning #2099: Missing type specifier; assuming 'int'.
C:\Program Files\PellesC\Include\Win\mmreg.h(2060): error #2078: Invalid struct field declarations.
C:\Program Files\PellesC\Include\Win\mmreg.h(2060): error #2001: Syntax error: expected '}' but found 'WAVEFORMATEX'.
C:\Program Files\PellesC\Include\Win\mmreg.h(2060): warning #2014: Empty declaration.
C:\Program Files\PellesC\Include\Win\mmreg.h(2061): warning #2099: Missing type specifier; assuming 'int'.
C:\Program Files\PellesC\Include\Win\mmreg.h(2061): error #2001: Syntax error: expected ';' but found 'wRevision'.
C:\Program Files\PellesC\Include\Win\mmreg.h(2061): warning #2099: Missing type specifier; assuming 'int'.
C:\Program Files\PellesC\Include\Win\mmreg.h(2062): warning #2099: Missing type specifier; assuming 'int'.
C:\Program Files\PellesC\Include\Win\mmreg.h(2062): error #2001: Syntax error: expected ';' but found 'nSamplesPerBlock'.
C:\Program Files\PellesC\Include\Win\mmreg.h(2062): warning #2099: Missing type specifier; assuming 'int'.
If you are compiling a Windows program, make sure you use the /Ze option!
*** Error code: 1 ***
Done.

The actual list is longer than that but the forum won't let me post the whole list. 

At the end it says to use the /Ze option, but that's part of the default compiler string shown above. 

My source code does not include mmreg.h and it has nothing to do with building a multimedia device. 

Thanks for any help on this. 

« Last Edit: April 03, 2018, 12:38:27 am by wtrC11pgx »

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 1813
Re: Long list of errors from mmreg.h file
« Reply #1 on: April 03, 2018, 08:41:52 am »
Check project include files again.
For example Edit -> Find in files... mmreg.h
May the source be with you

Offline wtrC11pgx

  • Member
  • *
  • Posts: 4
Re: Long list of errors from mmreg.h file
« Reply #2 on: April 03, 2018, 05:38:19 pm »
Edit -> Find in files... mmreg.h comes up with none found.  When I remove mmreg.h from the Pelles include folder, here is the list of errors I get.  I am not including any of these headers in my C program.  My only include file is a python custom header file.  I do not include appavcap.h or mmreg.h so I don't know why these are called at all. 

Building C_DLL_Code.obj.
C:\Program Files\Python36\include\pymath.h(22): error #2120: Redeclaration of 'round', previously declared at C:\Program Files\PellesC\Include\math.h(146); expected 'double __cdecl function(double)' but found 'double __fastcall function(double)'.
C:\Program Files\Python36\include\pytime.h(111): warning #2230: Type '(incomplete) struct timeval' declared inside parameter list.
C:\Program Files\Python36\include\pytime.h(116): warning #2230: Type '(incomplete) struct timeval' declared inside parameter list.
C:\Program Files\PellesC\Include\Win\appavcap.h(10): fatal error #1035: Can't find include file <mmreg.h>.
*** Error code: 1 ***
Done.


Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 1813
Re: Long list of errors from mmreg.h file
« Reply #3 on: April 03, 2018, 07:01:02 pm »
Python 3.6 headers don't include that appavcap.h/mmreg.h either?
Tested with Python.h and simple pyconfig.h without any errors.
Code: [Select]
#define SIZEOF_WCHAR_T 2
#define HAVE_COPYSIGN
#define HAVE_ROUND
#define HAVE_HYPOT
#define NT_THREADS
With what kind of custom python header have all those errors?
« Last Edit: April 04, 2018, 08:11:52 am by TimoVJL »
May the source be with you

Offline wtrC11pgx

  • Member
  • *
  • Posts: 4
Re: Long list of errors from mmreg.h file
« Reply #4 on: April 03, 2018, 07:30:16 pm »
Python.h is the header file for the Python C/API.  No the Python 3.6 include folder does not have those other two headers. 

"Tested with Python.h and simple pyconfig.h without any errors."  Can you show me the compiler and linker directives you used? 

Thanks. 


Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 1813
Re: Long list of errors from mmreg.h file
« Reply #5 on: April 03, 2018, 07:49:25 pm »
Python.h is the header file for the Python C/API.  No the Python 3.6 include folder does not have those other two headers.
Somewhere is an #include for example like for vfw.h that include those files.

"Tested with Python.h and simple pyconfig.h without any errors."  Can you show me the compiler and linker directives you used?
Code: [Select]
SET Path=%PellesCDir%\bin
SET INCLUDE=%PellesCDir%\include;C:\code\Python\v3.6\include
SET LIB=%PellesCDir%\lib;%PellesCDir%\lib\Win64
pocc -Tx64-coff -Gr -Ze test.c
polink -dll test.obj
pause
« Last Edit: April 04, 2018, 07:53:11 am by TimoVJL »
May the source be with you

Offline wtrC11pgx

  • Member
  • *
  • Posts: 4
Re: Long list of errors from mmreg.h file
« Reply #6 on: April 03, 2018, 08:13:35 pm »
Thanks for your reply.  You compiled on the command line? 


Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 1813
Re: Long list of errors from mmreg.h file
« Reply #7 on: April 04, 2018, 08:02:10 am »
Building C_DLL_Code.obj.
C:\Program Files\Python36\include\pymath.h(22): error #2120: Redeclaration of 'round', previously declared at C:\Program Files\PellesC\Include\math.h(146); expected 'double __cdecl function(double)' but found 'double __fastcall function(double)'.
A fix for that? define HAVE_ROUND
Code: [Select]
-std:C11 -Tx64-coff -Ot -Ob1 -fp:precise -W1 -Gr -Ze -DHAVE_ROUNDHeaders was from package python-3.6.5-amd64.exe

A test with poide:
Python headers from Python-3.6.0.tar.xz
A small pyconfig.h for x64 as sources don't have it:
Code: [Select]
#define SIZEOF_WCHAR_T 2
#define HAVE_COPYSIGN
#define HAVE_ROUND
#define HAVE_HYPOT
#define NT_THREADS
Code: [Select]
-std:C11 -Tx64-coff -Ot -Ob1 -fp:precise -W1 -Gr -Zex64 use -Gr __fastcall

EDIT: An example spam.pyd
Code: [Select]
#define HAVE_ROUND
#include <Python.h>
// https://docs.python.org/3/extending/extending.html
static PyObject *
spam_system(PyObject *self, PyObject *args)
{
    const char *command;
    int sts;

    if (!PyArg_ParseTuple(args, "s", &command))
        return NULL;
    sts = system(command);
    return PyLong_FromLong(sts);
}

static PyMethodDef SpamMethods[] = {
    {"system", spam_system, METH_VARARGS, "Execute a shell command."},
    {NULL, NULL, 0, NULL}        /* Sentinel */
};

static struct PyModuleDef spammodule = {
    PyModuleDef_HEAD_INIT,
    "spam",   /* name of module */
    0, //spam_doc, /* module documentation, may be NULL */
    -1,       /* size of per-interpreter state of the module,
                 or -1 if the module keeps state in global variables. */
    SpamMethods
};

static PyObject *SpamError;

PyMODINIT_FUNC
PyInit_spam(void)
{
    PyObject *m;

    m = PyModule_Create(&spammodule);
    if (m == NULL)
        return NULL;

    SpamError = PyErr_NewException("spam.error", NULL, NULL);
    Py_INCREF(SpamError);
    PyModule_AddObject(m, "error", SpamError);
    return m;
}
« Last Edit: April 05, 2018, 12:27:12 pm by TimoVJL »
May the source be with you