Problem in sharing data between EXE and SO file:

Hi All,

I am facing issue where

I have created new module which carries one global variable.

        plin_EXIBSInterface.c
                    
                    int RrbsConnStatus = 0;
                    
                    void PostXMLToEXIBS(){
                                ast_debug(2,"RrbsConnStatus in PostXMLToEXIBS=%d\n",RrbsConnStatus);
                                RrbsConnStatus++;
                    }
                    
        plin_EXIBSInterface.h
                    extern int RrbsConnStatus;

I have imported above .h file into main/asterik.c.

But same .h i have imported into apps/app_voicemail.c

Outcome is, global variable not getting shared among the imported c files(EXE and SHARED LIBRARY).

Other details are,

        I have created .exe by linking asterisk.c along with other set of .c files with plin_EXIBSInterface.o
        I have created app_voicemail.so by linking plin_EXIBSInterface.o
        Made asterisk .exe up, so obviously "app_voicemail.so" will be loaded.
        
        Invoking PostXMLToEXIBS() from asterisk.c and in plin_EXIBSInterface.c it prints "RrbsConnStatus in PostXMLToEXIBS=0". again i am calling from app_voicemail.c it prints as "RrbsConnStatus in PostXMLToEXIBS=0". Since i have updated "RrbsConnStatus" during first call to "PostXMLToEXIBS()", in second attempt from app_voicemail.c, it has to print RrbsConnStatus as 1 only. But i am getting 0 still.
        
        From above, understood that app_voicemail.so keeping separate copy.
        
        Is this the actual behaviour of asterisk design?
        Also in my case, how i can share the data between EXE and .so without using static variable and other concept?
        
        Can anyone suggestion really appreciated.

Regards,
Boobalan

This is an end user forum. There are a mailing list and an IRC channel for developers.

Moreover this sounds like a C/dynamically loaded shared libraries question, not a question specific to Asterisk.

When you go to asterisk-dev, you need to step back and ask about solutions to the problem that the shared variable is trying to solve.