Writting Pluggins

N

noridotjabi

Is there any way in C to write source which would make an executable
that excepted modifications. For instance say we have modable program
that excepts plugins. That starts with a menu.
1)Add 2)Subtract 0)Add Mod
::
When entering zero:
Mod Source
::(whatever.c or maybe .o would be better)

Say the mod we put in was to add a divide option to the main menu.
The program would then be:
1)Add 2)Subtract 3)Divide 0)Add Mod
::


In this mannor a program coud be written that could be updated by
makeing a plugin sortof like how in linux or some other *n*x system you
can use insmod. This doesn't seem to be system spasific to me. Infact
this doesn't even seem possible, however I am working on codeing a
mini-OS that would run on another by makeing its own filesystem which
just apears to the OS its running on as a large file. If anyone has
been following my posts this would make ALOT of sense. Thanks for the
help. If anyone is interested I'll post a link to my website when its
all done.
Nori
 
M

Malcolm

Is there any way in C to write source which would make an executable
that excepted modifications. For instance say we have modable program
that excepts plugins. That starts with a menu.
1)Add 2)Subtract 0)Add Mod
::
When entering zero:
Mod Source
::(whatever.c or maybe .o would be better)

Say the mod we put in was to add a divide option to the main menu.
The program would then be:
1)Add 2)Subtract 3)Divide 0)Add Mod
::


In this mannor a program coud be written that could be updated by
makeing a plugin sortof like how in linux or some other *n*x system you
can use insmod. This doesn't seem to be system spasific to me. Infact
this doesn't even seem possible, however I am working on codeing a
mini-OS that would run on another by makeing its own filesystem which
just apears to the OS its running on as a large file. If anyone has
been following my posts this would make ALOT of sense. Thanks for the
help. If anyone is interested I'll post a link to my website when its
all done.
Nori
The easy way is to modify the C source and recompile.

If you want to find out how to add scritping type capabilities so that users
can extend your system with arbitrary functions, with no recompile, check
out MiniBasic, on my website. Full compilable source is free. You can modify
it to your heart's content. If you want everything neatly together in a pdf
it costs $1.25, and you can have it printed and bound for a few dollars
more. (This is the wonder of Lulu).

If you want to produce a program that loads precompiled modules and plugs
them together, that isn't possible under standard C. Some operating systems
will let you do this, normally by providing what are known as dynamic
libraries. Try a newsgroup for your OS.
 
M

Mike Wahler

Is there any way in C to write source which would make an executable
that excepted modifications. For instance say we have modable program
that excepts plugins. That starts with a menu.
1)Add 2)Subtract 0)Add Mod
::
When entering zero:
Mod Source
::(whatever.c or maybe .o would be better)

Say the mod we put in was to add a divide option to the main menu.
The program would then be:
1)Add 2)Subtract 3)Divide 0)Add Mod
::


In this mannor a program coud be written that could be updated by
makeing a plugin sortof like how in linux or some other *n*x system you
can use insmod. This doesn't seem to be system spasific to me.

Oh, but it is. Most if not all operating systems control
what can and cannot be done to executable (or other types)
of files.
In fact
this doesn't even seem possible,

It might be on some platforms, but might not on others.

All that being said, standard C has no facilities
for doing this.

-Mike
 
A

Andrew Poelstra

Is there any way in C to write source which would make an executable
that excepted modifications. For instance say we have modable program
that excepts plugins. That starts with a menu.
1)Add 2)Subtract 0)Add Mod
::
When entering zero:
Mod Source
::(whatever.c or maybe .o would be better)

Say the mod we put in was to add a divide option to the main menu.
The program would then be:
1)Add 2)Subtract 3)Divide 0)Add Mod
::


In this mannor a program coud be written that could be updated by
makeing a plugin sortof like how in linux or some other *n*x system you
can use insmod. This doesn't seem to be system spasific to me. Infact
this doesn't even seem possible, however I am working on codeing a
mini-OS that would run on another by makeing its own filesystem which
just apears to the OS its running on as a large file. If anyone has
been following my posts this would make ALOT of sense. Thanks for the
help. If anyone is interested I'll post a link to my website when its
all done.
Nori

This simplest (and likely only portable) solution would be to have your
menu modifiable. So, your program would simply read something like
main.menu which would contain lines detailing what options you have and
what they do. You may want to make your own scripting language for that.

Self-modifiable code is impossible to do portably; the only system I've
used that would let me do so was a 286 (or later system in 16-bit
unprotected mode).
 
N

noridotjabi

If you want to find out how to add scritping type capabilities so that users
can extend your system with arbitrary functions, with no recompile, check
out MiniBasic, on my website. Full compilable source is free. You can modify
it to your heart's content. If you want everything neatly together in a pdf
it costs $1.25, and you can have it printed and bound for a few dollars
more. (This is the wonder of Lulu).

I'm not sure I understand how I would be able to impliment this. Is
there any chance that you can elaborate as to how I can use MiniBasic
to make it so that users could write pluggin style scripts that would
be used by the system. Reguardless I think I will include MiniBasic.
I have fooled around with it a bit and I like it. I will be sure to
give you credit for it.
Nori
 
M

Malcolm

I'm not sure I understand how I would be able to impliment this. Is
there any chance that you can elaborate as to how I can use MiniBasic
to make it so that users could write pluggin style scripts that would
be used by the system. Reguardless I think I will include MiniBasic.
I have fooled around with it a bit and I like it. I will be sure to
give you credit for it.
Nori
You want some of the functionality in the program to be added by the user,
at run time, rather than the programmer, at compile time.

*****
That starts with a menu.
1)Add 2)Subtract 0)Add Mod
::
When entering zero:
Mod Source
::(whatever.c or maybe .o would be better)

Say the mod we put in was to add a divide option to the main menu.
The program would then be:
1)Add 2)Subtract 3)Divide 0)Add Mod
*****

So they way you would do this, using MiniBasic, would be to have a button
which the user can press. This give a field for the name of the function,
and a text box for the code to achieve it.

So the user would enter "divide".

The script is set up so that the two operands are input, and the result
output

10 INPUT numerator
20 INPUT denominator
30 PRINT numerator / denominator

This performs a divide.

When you call the function, you aet up two temporary streams, plus another
one for errors. You insert the two operands into the input stream, call the
function, and extract the result from the output stream. You then test it
for legality.

So the user can add absolutely any function that he is able to program in
BASIC.

Fool about with the program and see what you think.
 
N

noridotjabi

I will no doubt be including MiniBasic in my Mini-OS (slightly ironic).
Thank you for the further depth in explanataion. This combined with
another technique is exactly what I am looking for. This allowing for
the user to write their own scripts is an excellent feature. Your
MiniBasic saved me the time for writting a scripting language from
scatch. Again thanks for the help and the MiniBasic program which I
feel diserves some publicity. Anyway thats just me.
Nori
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top