[asterisk-dev] Asterisk - 13.6.0 - Problem in sharing data between EXE and SO file:

Boobalan M boobalan.mb at plintron.com
Wed Jan 6 06:47:25 CST 2016


Hi Team,

 

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



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20160106/bb8d4ad4/attachment-0001.html>


More information about the asterisk-dev mailing list