Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
csst-pipeline
csst_proto
Commits
99cd6137
Commit
99cd6137
authored
Nov 02, 2023
by
Universebenzene
Browse files
Fix cextern helloworld
parent
5590255b
Pipeline
#1465
passed with stage
in 0 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
cextern/helloworld.c
View file @
99cd6137
// Simple C program to display "Hello World"
// Header file for input output functions
#include
<
stdio
.h>
#include
<
Python
.h>
// main function -
// where the execution of program begins
int
main
()
static
PyObject
*
_helloworld
(
PyObject
*
self
,
PyObject
*
args
)
{
printf
(
"Hello World
\n
"
);
return
Py_None
;
}
static
PyMethodDef
Methods
[]
=
{
{
"helloworld"
,
_helloworld
,
METH_NOARGS
,
"Prints Hello World"
},
{
NULL
,
NULL
,
0
,
NULL
}
};
// prints hello world
printf
(
"Hello World"
);
// Our Module Definition struct
static
struct
PyModuleDef
Module
=
{
PyModuleDef_HEAD_INIT
,
"helloworld"
,
"prints Hello World"
,
-
1
,
Methods
};
return
0
;
// Initializes our module using our above struct
PyMODINIT_FUNC
PyInit_helloworld
(
void
)
{
return
PyModule_Create
(
&
Module
);
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment