Lol, so, I got a job as a coder since the
begin of this month, so now I have a
few days off because of
ascension (? hemelvaart, says google translate)
it was 21 may, some christian feast)
Anyways, I got a few days off, so, what am I
doing in my spare time? coding! lol
I started coding some on my IRC bot again.
The design wasn’t right the way it should be,
and I moved some code from the IRC class to
the Bot class. Still isn’t quite the way I want it,
but it’s better now. Hard to separate, what should
be done by the protocol and what by the bot’s code.
But I should keep in mind some changes I am planning
to do later. I wish to separete my code into different
libraries, so, it should be possible to use the IRC protocol
class and use it to create an IRC client. Not that I am
planning to do so, but I just want the code to be clean.
Speaking about libraries, I am indeed planning to make
bot plugins also, just to load new commands into the
bot as a library. Not just that, I am also looking at some
stuff about mixing languages. As I am working at a
company that uses Delphi, I suppose my (Object) Pascal
skills to get better. So, I was looking at ways to mix
pascal and c(++) code.
So, there are two pascal compilers available for the
Linux platform. The GNU Pascal compiler and the
FreePascal compiler. Soon it turned out the GNU
compiler didn’t support libraries yet, so it fell off,
leaving the FreePascal compiler as the compiler to use.
Well… first I tried if I could just write some function
in Pascal, create an object file, and link it so some
object file from C code, but that fails, since the
pascal code expect the some pascal runtime code.
So, then writing an so file, failed… the compiler kept
complaining about linker errors, and this error
was mentioned on many internet sites as well
Free Pascal Compiler version 2.2.4-1 [2009/05/12] for x86_64
Copyright (c) 1993-2008 by Florian Klaempfl
Target OS: Linux for x86-64
Compiling t.pas
Linking libt.so
t.pas(17) Error: Can’t call the linker, switching to external linking
t.pas(17) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
Error: /usr/bin/ppcx64 returned an error exitcode (normal if you did not specify a source file to be compiled)
So, after trying some stuff, it turned out that adding the
parameter -XX (Smart Linking) to the compiler solves
the problem and generated a usable .so file, that can
be used from C code.
Not only the use of Pascal code is on the new stuff list
for the BlaatBot Project, I have also been looking into
some XML parsing code, to integrate some site stuff
into the bot. I have been using this XML parser to parse
some XML code, and so far I am happy with the results.
The author or that code also offered a possibility for a
BSD-style license, what would be great so I do not have
to worry about having to change my own license and
release my code under a BSD-style license as well, as it
has been in the past. For the moment, it’s just, the code
really needs some cleaning up, and when that’s done,
it will be released again. For the time being, there is
some ancient code from the project at sourceforge.
Don’t look at it, it’s ancient and ugly.