Sharing data between libraries

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jon Kneller

    #1

    Sharing data between libraries

    I have 2 seperate libraries, compiled to .so files (these are being loaded
    into a Tcl process).

    I would like to be able to share data (a linked list) between these
    libraries - one needs to modify the data, the other needs to search it. I
    cannot be certain that both libraries will loaded at any given time.
    Because the program using the libraries is Tcl, I can't store the data at
    that level.

    Any ideas on how I can achieve this?

    Thanks,
    Jon


  • Dan Pop

    #2
    Re: Sharing data between libraries

    In <cbrv3o$12c4$1@ sp15en20.hursle y.ibm.com> "Jon Kneller" <kneller@uk.ibm .com> writes:
    [color=blue]
    >I have 2 seperate libraries, compiled to .so files (these are being loaded
    >into a Tcl process).
    >
    >I would like to be able to share data (a linked list) between these
    >libraries - one needs to modify the data, the other needs to search it. I
    >cannot be certain that both libraries will loaded at any given time.
    >Because the program using the libraries is Tcl, I can't store the data at
    >that level.
    >
    >Any ideas on how I can achieve this?[/color]

    What was your C language question?

    Dan
    --
    Dan Pop
    DESY Zeuthen, RZ group
    Email: Dan.Pop@ifh.de

    Comment

    • kal

      #3
      Re: Sharing data between libraries

      "Jon Kneller" <kneller@uk.ibm .com> wrote in message news:<cbrv3o$12 c4$1@sp15en20.h ursley.ibm.com> ...
      [color=blue]
      > I have 2 seperate libraries, compiled to .so files (these are being loaded
      > into a Tcl process).[/color]

      <snip>
      [color=blue]
      > Any ideas on how I can achieve this?[/color]

      If "Tcl" is yet another language/environment then there
      probably are newsgroups for that. My $0.02 would be to
      get rid of one or both the libraries.

      Comment

      • Jon Kneller

        #4
        Re: Sharing data between libraries

        Thanks. I have tried comp.lang.tcl with no luck - merging the libraries is
        an option but a messy one (unfortunately most of the options available seem
        at least a little messy...)

        Jon

        "kal" <k_amir7@yahoo. com> wrote in message
        news:a5da4cc1.0 406291131.407a2 517@posting.goo gle.com...[color=blue]
        > "Jon Kneller" <kneller@uk.ibm .com> wrote in message[/color]
        news:<cbrv3o$12 c4$1@sp15en20.h ursley.ibm.com> ...[color=blue]
        >[color=green]
        > > I have 2 seperate libraries, compiled to .so files (these are being[/color][/color]
        loaded[color=blue][color=green]
        > > into a Tcl process).[/color]
        >
        > <snip>
        >[color=green]
        > > Any ideas on how I can achieve this?[/color]
        >
        > If "Tcl" is yet another language/environment then there
        > probably are newsgroups for that. My $0.02 would be to
        > get rid of one or both the libraries.[/color]


        Comment

        • Jon Kneller

          #5
          Re: Sharing data between libraries

          Sorry, I have just read my post back and it was far from clear.

          The question was, can I share data between 2 shared libraries in C, when
          these libraries are loaded into a C program which cannot change? Is it
          possible to call functions in one from the other? Is it possible to
          reference data in one from the other? Is there another way to have the
          libraries share data that I haven't seen?

          I am investigating shared memory at the moment but am unsure if there is a
          better approach.

          Jon

          "Dan Pop" <Dan.Pop@cern.c h> wrote in message
          news:cbs15i$nmk $1@sunnews.cern .ch...[color=blue]
          > In <cbrv3o$12c4$1@ sp15en20.hursle y.ibm.com> "Jon Kneller"[/color]
          <kneller@uk.ibm .com> writes:[color=blue]
          >[color=green]
          > >I have 2 seperate libraries, compiled to .so files (these are being[/color][/color]
          loaded[color=blue][color=green]
          > >into a Tcl process).
          > >
          > >I would like to be able to share data (a linked list) between these
          > >libraries - one needs to modify the data, the other needs to search it.[/color][/color]
          I[color=blue][color=green]
          > >cannot be certain that both libraries will loaded at any given time.
          > >Because the program using the libraries is Tcl, I can't store the data at
          > >that level.
          > >
          > >Any ideas on how I can achieve this?[/color]
          >
          > What was your C language question?
          >
          > Dan
          > --
          > Dan Pop
          > DESY Zeuthen, RZ group
          > Email: Dan.Pop@ifh.de[/color]


          Comment

          • Dan Pop

            #6
            Re: Sharing data between libraries

            In <cbu1lk$1f7a$1@ sp15en20.hursle y.ibm.com> "Jon Kneller" <kneller@uk.ibm .com> writes:
            [color=blue]
            >Sorry, I have just read my post back and it was far from clear.
            >
            >The question was, can I share data between 2 shared libraries in C, when
            >these libraries are loaded into a C program which cannot change? Is it
            >possible to call functions in one from the other? Is it possible to
            >reference data in one from the other? Is there another way to have the
            >libraries share data that I haven't seen?[/color]

            There is nothing library specific in your questions. Once your C
            libraries are becoming part of your program, everything should work as
            normal (a global variable defined in one library and declared in the
            other is transparently shared between the two libraries). Think about
            things like stdin and stdout, usually defined in one shared library.
            Ditto about calling fprintf from another library.

            Dan
            --
            Dan Pop
            DESY Zeuthen, RZ group
            Email: Dan.Pop@ifh.de

            Comment

            Working...