egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Problems with "global".. on compile-time (with my

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Modules & Programming
View previous topic :: View next topic  
Author Message
makam
Voice


Joined: 08 Jul 2004
Posts: 15
Location: Montevideo, Uruguay

PostPosted: Tue Aug 09, 2005 1:04 pm    Post subject: Problems with "global".. on compile-time (with my Reply with quote

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. Evil or Very Mad

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... Embarassed



...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
View user's profile Send private message Visit poster's website MSN Messenger
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Tue Aug 09, 2005 2:18 pm    Post subject: Reply with quote

remove that #undef or enclose it in #ifdef,#endif
Back to top
View user's profile Send private message Visit poster's website
makam
Voice


Joined: 08 Jul 2004
Posts: 15
Location: Montevideo, Uruguay

PostPosted: Tue Aug 09, 2005 3:58 pm    Post subject: :( Reply with quote

Doesnt work! Crying or Very sad

The same error.
Perhaps, the error is not the "#undef global", because i removed it and
enclose it, like u said.

hmhm.... Function *global? Confused Confused

Make log -> http://hteggviewer.makam.org/errors/make.log

The files:
http://hteggviewer.makam.org/errors/curl.c
http://hteggviewer.makam.org/errors/htlive.c

Rest of the files:
http://hteggviewer.makam.org/errors/



More ideas?
_________________
--
Web: http://www.makam.org/
Chans: #Uruguay,#Hattricklatino@UnderNet
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Tue Aug 09, 2005 9:01 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Galadhrim
Op


Joined: 11 Apr 2003
Posts: 123
Location: Netherlands, Enschede

PostPosted: Wed Aug 10, 2005 5:17 am    Post subject: Reply with quote

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
View user's profile Send private message
makam
Voice


Joined: 08 Jul 2004
Posts: 15
Location: Montevideo, Uruguay

PostPosted: Wed Aug 10, 2005 10:46 am    Post subject: Reply with quote

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);


Evil or Very Mad Evil or Very Mad ............. Crying or Very sad
_________________
--
Web: http://www.makam.org/
Chans: #Uruguay,#Hattricklatino@UnderNet
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Thu Aug 11, 2005 12:55 am    Post subject: Reply with quote

there is no global identifier in curl.h, you somehow messed up that in your code
Back to top
View user's profile Send private message Visit poster's website
makam
Voice


Joined: 08 Jul 2004
Posts: 15
Location: Montevideo, Uruguay

PostPosted: Thu Aug 11, 2005 8:05 am    Post subject: Fixed! Reply with quote

Well, the solution is very elegant Smile

I include the curl's headers file BEFORE src/mod/module.h header Smile

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 Smile


It works!!! Very Happy Very Happy Very Happy
Cool
_________________
--
Web: http://www.makam.org/
Chans: #Uruguay,#Hattricklatino@UnderNet
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Modules & Programming All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber