有这样三个函数 int test(color="red">lua_state* L) { } int test1(color="red">lua_state* L) { } int test2(color="red">lua_state* L) { } 我将同一个c函数注册为不同的名称 register("test1", test) register("test2", test) 就是想让所有的这些引用名称都指向同一个函数,然后不管color="red">调用什么函数都会通过这个test函数,在这个函数中做一些操作再回调到他们自己的函数中,比如"test1"转到test1所对应的函数中。 int test(color="red">lua_state* L) { //一些...
by mysll - C/C++ - 2008-10-04 15:07:06 阅读(1765) 回复(2)
http://www.cppblog.com/lxyfirst/archive/2008/10/29/65447.html
例e10.c [code]/* A simple color="red">lua interpreter. */ #include #include int main(int argc, char *argv[]) { char line[BUFSIZ]; color="red">lua_State *L = color="red">lua_open(0); while (fgets(line, sizeof(line), stdin) != 0) color="red">lua_dostring(L, line); color="red">lua_close(L); return 0; }[/code] 編譯 gcc e10.c -lcolor="red">lua -lcolor="red">lualib -o e10 出現下面錯誤訊息 e10.c:7:27: error: macro "color="red">lua_open" passed 1 arguments, but takes just 0 e10.c: In function ...
去年琢磨很长时间,贴出来共享。 依次执行: make make test test [ 本帖最后由 yuanchengjun 于 2007-4-29 13:15 编辑 ]
c# color="red">调用c++(DLL) 为什么c++传汉字, c#不能接收到????? 这是c#color="red">调用(c++ DL)L
//testcpp.h
#include
char **ppszTabTokens= (char**)malloc(sizeof(char *)); MYSQL mysql,*sock; TcHAR lpTemp[256]; LPcTSTR szLog; char szSql[256]; MYSQL_ROW row; //存放一行查询结果的字符串数组 MYSQL_RES *res; //查询结果集,结构类型 //char szSql2[256]; mysql_init(&mysql); if (!(sock = mysql_real_connect(&mysql,"localhost","root","123456","Mail",0,NULL,0))) { sprintf(lpTemp,"conncet is failed:%...
a.h [code]#ifndef __A__ #define __A__ #include "b.h" class First { public: First(); private: Second *se; }; #endif[/code] a.cpp #include "a.h" First::First() { se = new Second(); } int main() { First str; } ~ ~ b.h #ifndef __B__ #define __B__ #include "a.h" class Second { friend class First; public: Second(); private: First *s...
以Windows平台下使用Visual c++6.0为例 c代码:如FOO.c #include /* Define the method table. */ static PyObject *foo_bar(PyObject *self, PyObject *args); static PyMethodDef FooMethods[] = {{"bar", foo_bar, METH_VARARGS},{NULL, NULL}}; /* Here's the initialization function. We don't need to do anything for our own needs, but Python needs that method table. */ void initfoo() { (void) Py_InitModule(...
用systemcolor="red">调用shell,但shell执行时间很长,怎样在shell执行期间不让color="red">调用程序能进行其他操作?