sharing data in dll across threads - Windows CE

This is a discussion on sharing data in dll across threads - Windows CE ; Hi, I want to share a couple of global pointers across 2 threads. In DLL - i have a declared global pointer variable Ptr. DLL Exports 2 functions Init ( ) and Print ( ) The Init ( ) - ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: sharing data in dll across threads

  1. sharing data in dll across threads

    Hi,
    I want to share a couple of global pointers across 2 threads.


    In DLL - i have a declared global pointer variable Ptr.

    DLL Exports 2 functions Init ( ) and Print ( )

    The Init ( ) - is called from one thread (Say Thread A)
    Print ( ) is called from another thread. (Say Main Thread)

    Init ( ) - initialised Ptr to some allocated memory.

    Print ( ) - Prints the value of the initialised memory.


    Whats happening is Init ( ) - works properly
    Print ( ) - The value of the global shared variable is printed as 0
    (NULL).


    Why is this ?.


    I am using WinCE


    Regards,
    sriram


  2. Re: sharing data in dll across threads

    You have to map the object you are sharing to memory with some api calls to
    coredll.dll OpenFileMapping, CreateFileMapping, and MapViewOfFile

    Some google searches should turn up some usage examples:
    http://groups.google.com/group/micro...mpactframework





    "Ram" wrote in message
    news:1142420606.731831.63460@u72g2000cwu.googlegro ups.com...
    > Hi,
    > I want to share a couple of global pointers across 2 threads.
    >
    >
    > In DLL - i have a declared global pointer variable Ptr.
    >
    > DLL Exports 2 functions Init ( ) and Print ( )
    >
    > The Init ( ) - is called from one thread (Say Thread A)
    > Print ( ) is called from another thread. (Say Main Thread)
    >
    > Init ( ) - initialised Ptr to some allocated memory.
    >
    > Print ( ) - Prints the value of the initialised memory.
    >
    >
    > Whats happening is Init ( ) - works properly
    > Print ( ) - The value of the global shared variable is printed as 0
    > (NULL).
    >
    >
    > Why is this ?.
    >
    >
    > I am using WinCE
    >
    >
    > Regards,
    > sriram
    >




+ Reply to Thread