| View previous topic :: View next topic |
| Author |
Message |
makam Voice
Joined: 08 Jul 2004 Posts: 15 Location: Montevideo, Uruguay
|
Posted: Tue Aug 09, 2005 1:04 pm Post subject: Problems with "global".. on compile-time (with my |
|
|
Hi, i'm written my C module + xml + curl librarys
And my problems show up (it looks like) when i include the curl.h
in my module.
My main file is: htlive.c
and some part of the code is:
| Code: |
....
#include <string.h>
#undef global
#include "src/mod/module.h"
#include "src/users.h"
#include "src/chan.h"
#include "channels.mod/channels.h"
#include "htlive.h"
static Function *global = NULL, *channels_funcs = NULL,*server_funcs = NULL;
static char htlive_login[32]; // (Read htlive.conf)
static char htlive_passwd[32]; // (Read htlive.conf)
#include "curl.c"
....
|
In curl.c is where i include curl's headers...
| Code: |
#include <curl/curl.h>
#include <curl/easy.h>
|
Well, the problems is when i type "make"
| Code: |
gcc -pipe -fPIC -g -O2 -Wall -I. -I../../.. -I../../.. -I../../../src/mod -DHAVE_CONFIG_H `xml2-config --cflags` `curl-config --cflags` -DMAKING_MODS \
-c .././htlive.mod/htlive.c -Ixml
En el fichero incluído de ../htlive.mod/curl.c:5,
de ../htlive.mod/htlive.c:71:
/usr/include/curl/curl.h:772: error de decodificación antes de "global"
|
(Yes, its in spanish..)
The translation is something like this:
error de decodificación antes de "global" --> parsing error before "global"
I was thinking a lot, but any solution found.
Perhaps, the problems is that i dont know really why this
"#undef global" is there...
...any idea?
Thanks. _________________ --
Web: http://www.makam.org/
Chans: #Uruguay,#Hattricklatino@UnderNet
Last edited by makam on Thu Aug 11, 2005 8:09 am; edited 1 time in total |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Tue Aug 09, 2005 2:18 pm Post subject: |
|
|
| remove that #undef or enclose it in #ifdef,#endif |
|
| Back to top |
|
 |
makam Voice
Joined: 08 Jul 2004 Posts: 15 Location: Montevideo, Uruguay
|
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Tue Aug 09, 2005 9:01 pm Post subject: |
|
|
| of course, eggdrop exports the global array of function/variable pointers which are available for module use; try to fix curl not to interfere with that (or fix eggdrop to use another name, however that would be more dificult) |
|
| Back to top |
|
 |
Galadhrim Op
Joined: 11 Apr 2003 Posts: 123 Location: Netherlands, Enschede
|
Posted: Wed Aug 10, 2005 5:17 am Post subject: |
|
|
What happens when you comment the part of global in this line (line 64 in htlive.c:
| Code: | | static Function *global = NULL, *channels_funcs = NULL,*server_funcs = NULL; |
change to
| Code: | | static Function *channels_funcs = NULL,*server_funcs = NULL; |
I think demond is right as you have no real error in your code. It would not be advisable to change the name of eggdrop's global variable, but then again it is not advisable to change the curl's global variable either :S
Be sure to replace the name in all the files of either program if you do. |
|
| Back to top |
|
 |
makam Voice
Joined: 08 Jul 2004 Posts: 15 Location: Montevideo, Uruguay
|
Posted: Wed Aug 10, 2005 10:46 am Post subject: |
|
|
| Galadhrim wrote: | What happens when you comment the part of global in this line (line 64 in htlive.c:
| Code: | | static Function *global = NULL, *channels_funcs = NULL,*server_funcs = NULL; |
change to
| Code: | | static Function *channels_funcs = NULL,*server_funcs = NULL; |
|
But it dont resolve anything.
I use nmalloc, where is defined in the global variable.
Also i need register the module, in the _start function.
| Code: |
char *htlive_start(Function *global_funcs) {
p_tcl_bind_list H_temp;
global = global_funcs;
module_register(MODULE_NAME, htlive_table, HTLIVE_MAJORV, HTLIVE_MINORV);
|
.............  _________________ --
Web: http://www.makam.org/
Chans: #Uruguay,#Hattricklatino@UnderNet |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Thu Aug 11, 2005 12:55 am Post subject: |
|
|
| there is no global identifier in curl.h, you somehow messed up that in your code |
|
| Back to top |
|
 |
makam Voice
Joined: 08 Jul 2004 Posts: 15 Location: Montevideo, Uruguay
|
Posted: Thu Aug 11, 2005 8:05 am Post subject: Fixed! |
|
|
Well, the solution is very elegant
I include the curl's headers file BEFORE src/mod/module.h header
So, in the curl.c is "empty"... and the htlive.c:
| Code: |
.....
#include <string.h>
#include <curl/curl.h>
#include <curl/easy.h>
#undef global
#include "src/mod/module.h"
....
#include "curl.c"
...
|
I think that the macros defined in module.h doesnt like very much to curl
It works!!!
 _________________ --
Web: http://www.makam.org/
Chans: #Uruguay,#Hattricklatino@UnderNet |
|
| Back to top |
|
 |
|