Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Writting Pluggins

Reply
Thread Tools

Writting Pluggins

 
 
noridotjabi@gmail.com
Guest
Posts: n/a
 
      05-13-2006
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

 
Reply With Quote
 
 
 
 
Malcolm
Guest
Posts: n/a
 
      05-13-2006

<> wrote in message
> 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.

--
www.personal.leeds.ac.uk/~bgy1mm



 
Reply With Quote
 
 
 
 
Mike Wahler
Guest
Posts: n/a
 
      05-13-2006

<> wrote in message
news: oups.com...
> 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


 
Reply With Quote
 
Andrew Poelstra
Guest
Posts: n/a
 
      05-13-2006
On 2006-05-13, <> wrote:
> 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).
 
Reply With Quote
 
noridotjabi@gmail.com
Guest
Posts: n/a
 
      05-13-2006
>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

 
Reply With Quote
 
Malcolm
Guest
Posts: n/a
 
      05-13-2006
<> wrote in message
> >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
>

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.

--
www.personal.leeds.ac.uk/~bgy1mm



 
Reply With Quote
 
noridotjabi@gmail.com
Guest
Posts: n/a
 
      05-14-2006
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


Malcolm wrote:
> <> wrote in message
> > >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
> >

> 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.
>
> --
> www.personal.leeds.ac.uk/~bgy1mm


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Java and Pluggins teak@linuxmail.org A+ Certification 1 02-19-2005 07:02 PM
Access denied when writting to Application directory José Joye ASP .Net 5 05-31-2004 07:40 AM
Multi-Line TextBox writting to Sql Server John Carnahan ASP .Net 2 05-28-2004 12:22 AM
Writting javascript or vbscript in Visual Studio.Net Hai Nguyen ASP .Net 0 02-26-2004 06:50 PM
15 YEAR OLD WRITTING MCSE THIS WEEK Synacize Mindlabs MCSE 4 06-30-2003 01:57 PM



Advertisments