Problem in sharing data between EXE and SO file:

Get help with installing, upgrading and running Asterisk.

Moderators: muppetmaster, Moderator, Support

Problem in sharing data between EXE and SO file:

Postby boobalan » Wed Jan 06, 2016 11:07 pm

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
boobalan
Newsterisk
 
Posts: 3
Joined: Sat Dec 26, 2015 6:30 am

Re: Problem in sharing data between EXE and SO file:

Postby david55 » Thu Jan 07, 2016 7:41 am

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.
david55
Moves Like Spencer
 
Posts: 12570
Joined: Fri Sep 26, 2008 5:03 am


Return to Asterisk Support

Who is online

Users browsing this forum: Exabot [Bot] and 1 guest