Tag: global variables

使用netbeans定义的GUI在postgreSQL中调用位于“postgres.c”中的用户定义函数

我想在PostgreSQL-8.4.15中添加3个user_defined函数。 这里有3个function: (1) start_create_profile(); (2) make_profile(); (3) check_anomaly(); 所有这些都写在位于src / backend / tcop的文件“test.c”中。 我想从exec_simple_query()的中间调用(1)和(3 exec_simple_query() 。 exec_simple_query()是PostgreSQL函数,它写在位于src / backend / tcop的“postgres.c”中。 我想直接通过我的GUI调用(2)。 这是我在“test.c”中编写的代码: #include “postgres.h” #ifndef PROGPROFILE_H_ #define PROGPROFILE_H_ /* interfaces */ extern void start_create_profile(List *querytree_list); extern void create_profile(); extern void check_anomaly(List *querytree_list); #endif /* Test ProgProf */ void start_create_profile(List *querytree_list){ ListCell *l; ListCell *tl; […]

C和C ++中的静态和外部全局变量

我做了2个项目,第一个用C语言,第二个用C ++编写,两个项目都有相同的行为。 C项目: header.h int varGlobal=7; main.c中 #include #include #include “header.h” void function(int i) { static int a=0; a++; int t=i; i=varGlobal; varGlobal=t; printf(“Call #%d:\ni=%d\nvarGlobal=%d\n\n”,a,i,varGlobal,t); } int main() { function(4); function(6); function(12); return 0; } C ++项目: header.h int varGlobal=7; main.cpp中 #include #include “header.h” using namespace std; void function(int i) { static int a=0; int […]