Writting Pluggins

Discussion in 'C Programming' started by noridotjabi@gmail.com, May 13, 2006.

  1. Guest

    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
    , May 13, 2006
    #1
    1. Advertising

  2. Malcolm Guest

    <> 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
    Malcolm, May 13, 2006
    #2
    1. Advertising

  3. Mike Wahler Guest

    <> wrote in message
    news:...
    > 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
    Mike Wahler, May 13, 2006
    #3
  4. 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).
    Andrew Poelstra, May 13, 2006
    #4
  5. Guest

    >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
    , May 13, 2006
    #5
  6. Malcolm Guest

    <> 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
    Malcolm, May 13, 2006
    #6
  7. Guest

    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
    , May 14, 2006
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Hai Nguyen
    Replies:
    0
    Views:
    1,944
    Hai Nguyen
    Feb 26, 2004
  2. John Carnahan

    Multi-Line TextBox writting to Sql Server

    John Carnahan, May 27, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    8,587
    John Carnahan
    May 28, 2004
  3. José Joye
    Replies:
    5
    Views:
    444
    José Joye
    May 31, 2004
  4. Adrian Parker

    Writting RegularExpressionValidator for time?

    Adrian Parker, Sep 27, 2004, in forum: ASP .Net
    Replies:
    6
    Views:
    4,411
    Adrian Parker
    Sep 27, 2004
  5. Boris Condarco

    writting excel files

    Boris Condarco, Oct 12, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    2,882
Loading...

Share This Page