| View previous topic :: View next topic |
| Author |
Message |
sKy Op

Joined: 14 Apr 2005 Posts: 194 Location: Germany
|
Posted: Thu Jun 21, 2007 11:15 am Post subject: Expand eggdrop using C++? |
|
|
Is there a way to plug in C++ code into eggdrop (like plug in tcl scripts into eggdrop)? I don`t mean modules in C.
Is there some eggdrop -> tcl -> C++ bridge? I found cpptcl on sourceforge, but I have no idea if it could work with eggdrop. _________________ socketapi | Code less, create more. |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Thu Jun 21, 2007 8:16 pm Post subject: |
|
|
How would you run C++-code if you don't either compile it into the binary itself, or a loadable module?
That said, the last C++-project was many years ago, when 1.3.24 was state of the art in eggdrop.. This was eggdrop2 (not eggdrop v2.xx), which did not make much progress and siezed development shortly after it was made official. Since then, development on the plain C eggdrop had continued for several years.
It has been ages since I messed with C++, so I cannot say how much work it would be to write an eggdrop-module in C++. _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
sKy Op

Joined: 14 Apr 2005 Posts: 194 Location: Germany
|
Posted: Thu Jun 21, 2007 9:26 pm Post subject: |
|
|
| nml375 wrote: | | How would you run C++-code if you don't either compile it into the binary itself, or a loadable module? |
I have no idea. That`s why I ask here.
I saw a very inspiring function in Delphi. If I got it right you can just write anywhere in your source
ASM
- ASM code here <
END ASM. Kinda cool if you really need asm.
Thought it`s possible third party tcl script to have a similar function in tcl too.
That`s why I am asking.
Modules seam kinda complicated. For debugging you always need to recompile the hole bot and if you think about sharing your work for endusers it`s kinda uncomfortable for them tool compared to tcl scripts.
What do you mean with 'compile it into the binary itself'? I can compile it.. Sure. But how to plug it into eggdrop? Recompile? :/ _________________ socketapi | Code less, create more. |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Thu Jun 21, 2007 9:40 pm Post subject: |
|
|
Tcl is a pure scripting-language, while C and C++ are programming languages...
Simply put, tcl is parsed at runtime, using "alot" of resources at runtime to interpret instructions. C (and C++) however, is compiled into machinecode, which is then used for execution.
Using assembler instructions in a scripting-language (asm) really is'nt practicle, as asm knows nothing of variables, fancy function names, etc. It basically is a mnemonic with a few parameters, usually being register address, memory address, or direct values. Languages such as tcl does'nt even allow you to find out the address where a variable is stored...
Most c/c++-compilers can handle assembly-instructions, and in many cases these can be intermixed with C and/or C++.
Now, for writing your own modules, checking the source of the various ones that comes with eggdrop is a good start, especially the woobie-module, as it's mainly there for demonstration purposes.
Roughly put however, you'll be expected to create a given set of functions that will be called upon certain events, such as when the module is loaded and unloaded. These should setup whatever needs to be done for your module to operate properly, such as registering functions and variables with tcl, creating/dropping bind-tables, etc... The ctcp-module makes quite a decent example on that. _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
De Kus Revered One

Joined: 15 Dec 2002 Posts: 1361 Location: Germany
|
Posted: Fri Jun 22, 2007 12:49 pm Post subject: |
|
|
GCC also supports assembler inclusion. Also running C++ code via TCL sounds a little strange, C++ isn't really made designed as interpreted language. Expect for the OOP there are only very few reasons to use C++ instead of C, not sure, but I believe I read somewhere that C even runs faster than C++, but might have been out of the context.
Then only thing that would make sense to "interpret C++" would be to compile to temp file and execute it ^-^, you could of course embedded code into a mainframe of source, to run headerless code, but I doubt that would make much sense, you would probably rather stick to development environment with interactive debugging etc.. _________________ De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens... |
|
| Back to top |
|
 |
sKy Op

Joined: 14 Apr 2005 Posts: 194 Location: Germany
|
Posted: Wed Sep 19, 2007 4:48 pm Post subject: |
|
|
I found now Tcl 8.4 has a load command (loads machine code) and Tcl 8.5 has also an unload command but didn`t try this with eggdrop yet. Sure you would still need to compile the source on a platform you want to run it. _________________ socketapi | Code less, create more. |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Wed Sep 19, 2007 5:02 pm Post subject: |
|
|
Actually, loadable tcl modules has been around since 7.5 and possibly earlier (too long ago to remember). And yes, just like eggdrop modules, these has to be compiled into a loadable binary library prior being loaded.
In fact, this is used by many scripts using mysql-databases along with tclmysql.
Also worth noting, with eggdrop modules, as long as you do not touch any of "eggdrop's" files, but simply work with the files of your module, there would be no need to compile anything else than your module. In fact, make would'nt even try to rebuild your eggdrop as it would see all files and dependancies as unchanged, and thus not needed to rebuild. _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
Kappa007 Voice
Joined: 26 Jul 2005 Posts: 38
|
Posted: Fri Jan 18, 2008 6:50 pm Post subject: |
|
|
| @sKy: i did a sample module in C++ a while back just search the forum... |
|
| Back to top |
|
 |
|
|
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
|
|