Building pjsua as DLL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Tom?s Valenta wrote:
> Hi,
> no depencies set --- it is obvious.
> To the second problem: Yes, this is the only error and I found out what it
> is caused by, perhaps. Function pj_throw_exception_() is declared in the
> header as:
> PJ_DECL_NO_RETURN(void) pj_throw_exception_(pj_exception_id_t id) 
> PJ_ATTR_NORETURN;
> and in the source it is defined as:
> PJ_DEF(void) pj_throw_exception_(int exception_id)
> So the error is that PJ_DECL_NO_RETURN does not declare a function with 
> dllexport, but PJ_DEF does.
> 
> Pjsua-lib library compiled as DLL works fine with empty 
> PJ_EXPORT_DEF_SPECIFIER so for my purposes I commented out the line in 
> cc_msvc.h. But if someone wants to call pj_throw_exception_() from the host 
> application, it must be declared dllexport as well. Declaring function with 
> dllexport in forward declaration (header) is enough. Doing so in definition 
> is needless then.
> 
> Vali
> 
> 
> ----- Original Message ----- 
> From: "Benny Prijono" <bennylp@xxxxxxxxx>
> To: "pjsip embedded/DSP SIP discussion" <pjsip at lists.pjsip.org>
> Sent: Tuesday, November 13, 2007 4:44 PM
> Subject: Re: Building pjsua as DLL
> 
> 
> Tom?s Valenta wrote:
>> Hi Benny,
>>
>> I am reporting some problems with building pjsua as DLL in Visual Studio
>> 8.
>> In VS8 solution I declare macros PJ_DLL and PJ_EXPORTING in projects whose
>> functions I want to use (e.g. pjlib, pjmedia and pjsua-lib). In project
>> pjsua-lib I set output as DLL. Macros PJ_EXPORT_DECL_SPECIFIER etc. are
>> automaticaly defined in cc_msvc.h.
> 
> Thanks for reporting this. I never tried to build the libraries as
> DLL myself, so any feedbacks on this will be good.
> 
>> First problem:
>> In the solution there are no depencies on other projects so the projects
>> won't be built and linked. I had to set the depencies manually to the same
>> ones as in pjsua app.
> 
> Yeah, that's expected. As a static library, pjsua-lib does not need
> to have dependencies to other libs, hence the dependencies were not set.
> 
>> Second problem:
>> See following compiler error:
>>
>> c:\pjproject-0.8.0\pjlib\src\pj\except.c(41) : error C2375:
>> 'pj_throw_exception_' : redefinition; different linkage
>> c:\pjproject-0.8.0\pjlib\include\pj\except.h(302) : see declaration of
>> 'pj_throw_exception_'
> 
> Was this the only error that you get? I expect to see more similar
> errors from other sources frankly.
> 
>> I don't know exactly what it means but commenting out the line
>> //#define PJ_EXPORT_DEF_SPECIFIER     __declspec(dllexport)
>> in cc_msvc.h solves the problem.
> 
> So does the DLL work? Do you see symbols exported from the DLL?
> 
> I kinda expect that this wouldn't work, as you just disabled the
> syntax to export the symbols. But I could be wrong!
> 
>   -benny
> 
>> Have a nice day.
>>     Vali




[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux