我刚刚开始在Linux上使用gcc。我正在学习教程here,只是我在使用g++编译器。
你好,cpp#include
#include "hello.h"
void
hello (const char * name)
{
printf ("Hello, %s!\n", name);
}
再见,cpp#include
#include "hello.h"
void
bye (void)
{
printf ("Goodbye!\n");
}
你好,hvoid hello (const char * name);
void bye (void);
然后在shell中运行以下命令:$ g++ -Wall -c hello_fn.cpp
$ g++ -Wall -c bye_fn.cpp
$ ar cr libhello.a hello_fn.o bye_fn.o
然后我从python中尝试以下操作:Python 2.7.1+ (r271:86832, Apr 11 2011, 18:05:24)
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import ctypes
>>> test = ct