This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

acces to variables

Old posts that have not been replied to for several years.
Locked
S
Shmupsik
Voice
Posts: 23
Joined: Sat May 15, 2004 1:54 pm
Location: Russia

acces to variables

Post by Shmupsik »

I have next problem: in my module to eggdrop i need a list of logfiles currently attached to bot (i.e. with the command "logfile" in config file). when I try to use next code:

Code: Select all

...
extern int max_logs;
extern log_t *logs;
...
for (i = 0; i < max_logs; i++) {
...
}
...
on compilation of module i've got next errors: "undefined reference to `_max_logs'" and "undefined reference to `_logs'"

what is the solve? is there another way to get list of this logfiles?

P.S. sorry for my bad english, it's not my native language...
Now, this Bell tolling softly for another, saies to me, Thou must die.
S
Shmupsik
Voice
Posts: 23
Joined: Sat May 15, 2004 1:54 pm
Location: Russia

Post by Shmupsik »

word "access" must be with 2 "s"...
Now, this Bell tolling softly for another, saies to me, Thou must die.
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

the solution is to patch eggdrop to export max_logs for module use (i.e. adding max_logs to global_table in src/modules.c and src/mod/module.h)

it might be possible however to access such unexported vars simply by declaring them extern - albeit not recommended, you might wish to try it
S
Shmupsik
Voice
Posts: 23
Joined: Sat May 15, 2004 1:54 pm
Location: Russia

Post by Shmupsik »

another question: there is function (for use in tcl scripts) with name "logfile", declared in tclmisc.c, is there way to call such tcl functions in my module, and to get result of this functions back to my module?
(i've tried to use "do_tcl" but it wasn't work, perhaps i've done somthing wrong?)

(is it all clear with my sequence of tenses? :))
Now, this Bell tolling softly for another, saies to me, Thou must die.
S
Shmupsik
Voice
Posts: 23
Joined: Sat May 15, 2004 1:54 pm
Location: Russia

Post by Shmupsik »

demond wrote:the solution is to patch eggdrop to export max_logs for module use (i.e. adding max_logs to global_table in src/modules.c and src/mod/module.h)
and will my module be working if i decide to export only *.so (or *.dll for win platform) module without a source code?
Now, this Bell tolling softly for another, saies to me, Thou must die.
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

Shmupsik wrote:
demond wrote:the solution is to patch eggdrop to export max_logs for module use (i.e. adding max_logs to global_table in src/modules.c and src/mod/module.h)
and will my module be working if i decide to export only *.so (or *.dll for win platform) module without a source code?
I don't get that, seems you are somewhat confused about the whole module thing and programming in general
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

Shmupsik wrote:another question: there is function (for use in tcl scripts) with name "logfile", declared in tclmisc.c, is there way to call such tcl functions in my module, and to get result of this functions back to my module?
(i've tried to use "do_tcl" but it wasn't work, perhaps i've done somthing wrong?)

(is it all clear with my sequence of tenses? :))
do_tcl() should work, it's properly exported in modules.c and mod/module.h, but you can't get the result back to you; use Tcl_Eval() family of functions (and Tcl_SetVar()) to invoke a TCL command and get the result
Locked