[pjsip] Building pjsua as DLL

Roland Klabunde roland.klabunde at freenet.de
Sat Nov 17 04:50:51 EST 2007


Thank you Tomás and Benny and have a nice weekend.

Regards

----- Original Message ----- 
From: "Benny Prijono" <bennylp at pjsip.org>
To: "pjsip embedded/DSP SIP discussion" <pjsip at lists.pjsip.org>
Sent: Saturday, November 17, 2007 2:47 AM
Subject: Re: [pjsip] Building pjsua as DLL


Yes, that's correct. Thanks for clarifying this.

In addition, if you're linking your application with the DLL version
of the libraries, and if you have C or C++ application, you need to
declare PJ_DLL macro (and not PJ_EXPORTING) in your application's
project, to activate __declspec(dllimport) specifier in PJ's
declarations.

cheers,
  -benny

Tomás Valenta wrote:
> Hi Roland,
> yeah, this is an old recommendation. It might work as well, but now you
> don't have to modify any source. Setting project type to DLL and declaring
> macros PJ_DLL and PJ_EXPORTING at projects (i.e. pjlib, pjmedia, ...) 
> whose
> functions you want to use is enough. Resulting DLL works fine.
> Cheers
>     Vali
>
>
> ----- Original Message ----- 
> From: "Roland Klabunde" <roland.klabunde at freenet.de>
> To: "pjsip embedded/DSP SIP discussion" <pjsip at lists.pjsip.org>
> Sent: Friday, November 16, 2007 2:48 PM
> Subject: Re: [pjsip] Building pjsua as DLL
>
>
> May I ask that again?
>
> Regards
>
> ----- Original Message ----- 
> From: "Roland Klabunde" <roland.klabunde at freenet.de>
> To: "pjsip embedded/DSP SIP discussion" <pjsip at lists.pjsip.org>
> Sent: Friday, November 16, 2007 9:20 AM
> Subject: Re: [pjsip] Building pjsua as DLL
>
>
> Hello guys,
>
> I've found a rather old recommendation from Benny in my notes about how to
> build a DLL, which I used a year ago or so in order to build DLLs:
>
> <snip>
>
>
> Next, you'd need to modify pjsua.h. Just below PJ_BEGIN_DECL line, add
>
> this snippet:
>
>
>
> #if defined(PJ_EXPORTING) && PJ_EXPORTING!=0
>
> # undef PJ_DECL
>
> # undef PJ_DEF
>
> # define PJ_DECL(T)    __declspec(dllexport) T
>
> # define PJ_DEF(T)    PJ_DECL(T)
>
> #elif defined(PJ_IMPORTING) && PJ_IMPORTING!=0
>
> # undef PJ_DECL
>
> # undef PJ_DEF
>
> # define PJ_DECL(T)    __declspec(dllimport) T
>
> # define PJ_DEF(T)    PJ_DECL(T)
>
> #endif
>
>
>
> Next, add PJ_EXPORTING=1 macro in the DLL project settings.
>
>
>
> Build the project, and you'll get the DLL.
>
>
>
> I haven't tried loading the DLL myself, but if you have any problems,
>
> then perhaps you need to implement DllMain() function.
>
>
>
> cheers,
>
> -benny
>
>
>
>
>
> </snip>
>
> Because I already handed over the project to a colleague, who reported
> problems to rebuild the DLLs using one of the latest SVN revs: Is the
> recommendation above still OK, or did it change? If yes, how is the way to
> build a DLL now?
>
> Kind regards
>
>
>
> ----- Original Message ----- 
> From: "Benny Prijono" <bennylp at pjsip.org>
> To: "pjsip embedded/DSP SIP discussion" <pjsip at lists.pjsip.org>
> Sent: Friday, November 16, 2007 4:51 AM
> Subject: Re: [pjsip] Building pjsua as DLL
>
>
>
> Thanks for testing it, Vali. I've committed the change in SVN.
>
> cheers,
>   -benny
>
> Tomás Valenta wrote:
>> Thank you, it does work! And it is smart. I could not find this because
>> Intellisense keep telling me that the source is C++ (__cplusplus defined;
>> I was playing only with this branch of macros) but it is compiled as ANSI
>> C.
>> Strange.
>> Cheers
>>     Vali
>>
>>
>> ----- Original Message ----- 
>> From: "Benny Prijono" <bennylp at pjsip.org>
>> To: "pjsip embedded/DSP SIP discussion" <pjsip at lists.pjsip.org>
>> Sent: Wednesday, November 14, 2007 4:45 AM
>> Subject: Re: [pjsip] Building pjsua as DLL
>>
>>
>> Thanks for the info. Can I ask for a favor to try out these patch?
>>
>> What if instead of commenting out PJ_EXPORT_DEF_SPECIFIER, we change
>> the PJ_DECL_NO_RETURN declaration in pj/config.h to something like this:
>>
>> #ifdef __cplusplus
>> #  define PJ_DECL_NO_RETURN(type)   PJ_DECL(type) PJ_NORETURN
>> #else
>> #  define PJ_DECL_NO_RETURN(type)   PJ_NORETURN PJ_DECL(type)
>> #endif
>>
>> Does this work for your DLL?
>>
>> If it does, I would prefer this approach since the empty
>> PJ_EXPORT_DEF_SPECIFIER may not work for other platforms (such as
>> Symbian, which IIRC expects the export specification in the
>> definition rather than in declaration).
>>
>> cheers,
>>   -benny
>
>
>
> _______________________________________________
> Visit our blog: http://blog.pjsip.org
>
> pjsip mailing list
> pjsip at lists.pjsip.org
> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>
>
> _______________________________________________
> Visit our blog: http://blog.pjsip.org
>
> pjsip mailing list
> pjsip at lists.pjsip.org
> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>
>
> _______________________________________________
> Visit our blog: http://blog.pjsip.org
>
> pjsip mailing list
> pjsip at lists.pjsip.org
> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>
>
>
>
>
> _______________________________________________
> Visit our blog: http://blog.pjsip.org
>
> pjsip mailing list
> pjsip at lists.pjsip.org
> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org


-- 
Benny Prijono
http://www.pjsip.org


_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip at lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org





More information about the pjsip mailing list