BP
Benny Prijono
Tue, Nov 13, 2007 3:44 PM
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
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
JA
jorge.amador@withus.pt
Tue, Nov 13, 2007 4:15 PM
Hi Benny,
I created 2 rtp transports successfully, one each eth device. Now I
have a different problem. It seems to me that I can't have 2 calls at
the same time because only 1 stream is created. I checked the code and
I found a commentary in pjsua_media.c that says the following:
/* Create media session info based on SDP parameters.
- We only support one stream per session at the moment
*/
Is only one RTP stream supported? Is it possible to have more?
Jorge Amador
Quoting Benny Prijono bennylp@pjsip.org:
Ouch, you're right, it's not implemented yet. Sorry! But anyway this
function does not solve your requirement, so I don't think it
matters too much.
In summary, currently we can't assign specific RTP transports to a
specific account with pjsua-lib. Supporting this will require quite
major modifications in the API, for example to move media transport
config (and perhaps STUN settings) to account config. Maybe I will
consider doing this in the next major release, but for sure this
will break existing applications, so I'd rather not do this unless
there are really important reasons to do it.
So if you can't accept this limitation, my only suggestion for now
is to go with using the lower level APIs (pjsip and pjmedia).
cheers,
-benny
jorge.amador@withus.pt wrote:
Hi Benny,
I've followed your suggestion but after trying to compile the project I
get this error message:
output/pjsua-i686-pc-linux-gnu/pjsua_app.o: In function app_init': output/pjsua-i686-pc-linux-gnu/pjsua_app.o(.text+0x6303): undefined reference to pjsua_media_transports_attach'
I've checked the code and I only found the declaration of the function
pjsua_media_transports_attach() in the file pjsua.h. It seems to me that
this function is declared but not implemented in the code. Am I missing
something? Thanks,
Jorge Amador
Quoting Benny Prijono bennylp@pjsip.org:
Hi Benny,
I've changed to 0.8.0 version. Now I can bind an account to a specific
transport (in this case 2 different ethernet devices) but after checking
with ethereal I noticed that rtp transport is binded to only one off the
ethernet devices. I tried to create 2 rtp transports, one for each
ethernet device but failed with this error:
20:11:07.341 pjsua_media.c Unable to create RTP/RTCP socket: Cannot
assign requested address [status=120099]
Is it possible to create 2 rtp transports with the same application?
Thanks and best regards
It is possible to use multiple RTP transports of course, since
pjsua-lib supports multiple calls. Binding RTP transports to one
specific interface is also supported.
Binding different RTP transports to different IP interface can also
be done, but this requires application to pre-create the RTP
transports itself, and give it to pjsua-lib by calling
pjsua_media_transports_attach()
But what is not supported is, assigning specific RTP transport to
specific accounts. Currently each RTP transport will be assigned to
each call instance in the call array during pjsua-lib
initialization, and there's no association between RTP transport and
the account (since RTP transport can be used by any accounts).
So it's not possible to create specific RTP transport for specific
account.
-benny
Hi Benny,
I created 2 rtp transports successfully, one each eth device. Now I
have a different problem. It seems to me that I can't have 2 calls at
the same time because only 1 stream is created. I checked the code and
I found a commentary in pjsua_media.c that says the following:
/* Create media session info based on SDP parameters.
* We only support one stream per session at the moment
*/
Is only one RTP stream supported? Is it possible to have more?
Jorge Amador
Quoting Benny Prijono <bennylp@pjsip.org>:
> Ouch, you're right, it's not implemented yet. Sorry! But anyway this
> function does not solve your requirement, so I don't think it
> matters too much.
>
> In summary, currently we can't assign specific RTP transports to a
> specific account with pjsua-lib. Supporting this will require quite
> major modifications in the API, for example to move media transport
> config (and perhaps STUN settings) to account config. Maybe I will
> consider doing this in the next major release, but for sure this
> will break existing applications, so I'd rather not do this unless
> there are really important reasons to do it.
>
> So if you can't accept this limitation, my only suggestion for now
> is to go with using the lower level APIs (pjsip and pjmedia).
>
> cheers,
> -benny
>
> jorge.amador@withus.pt wrote:
>> Hi Benny,
>>
>> I've followed your suggestion but after trying to compile the project I
>> get this error message:
>>
>> output/pjsua-i686-pc-linux-gnu/pjsua_app.o: In function `app_init':
>> output/pjsua-i686-pc-linux-gnu/pjsua_app.o(.text+0x6303): undefined
>> reference to `pjsua_media_transports_attach'
>>
>> I've checked the code and I only found the declaration of the function
>> pjsua_media_transports_attach() in the file pjsua.h. It seems to me that
>> this function is declared but not implemented in the code. Am I missing
>> something? Thanks,
>>
>> Jorge Amador
>>
>>
>> Quoting Benny Prijono <bennylp@pjsip.org>:
>>
>>> jorge.amador@withus.pt wrote:
>>>> Hi Benny,
>>>>
>>>> I've changed to 0.8.0 version. Now I can bind an account to a specific
>>>> transport (in this case 2 different ethernet devices) but after checking
>>>> with ethereal I noticed that rtp transport is binded to only one off the
>>>> ethernet devices. I tried to create 2 rtp transports, one for each
>>>> ethernet device but failed with this error:
>>>>
>>>> 20:11:07.341 pjsua_media.c Unable to create RTP/RTCP socket: Cannot
>>>> assign requested address [status=120099]
>>>>
>>>> Is it possible to create 2 rtp transports with the same application?
>>>> Thanks and best regards
>>>
>>> It is possible to use multiple RTP transports of course, since
>>> pjsua-lib supports multiple calls. Binding RTP transports to one
>>> specific interface is also supported.
>>>
>>> Binding different RTP transports to different IP interface can also
>>> be done, but this requires application to pre-create the RTP
>>> transports itself, and give it to pjsua-lib by calling
>>> pjsua_media_transports_attach()
>>>
>>> But what is not supported is, assigning specific RTP transport to
>>> specific accounts. Currently each RTP transport will be assigned to
>>> each call instance in the call array during pjsua-lib
>>> initialization, and there's no association between RTP transport and
>>> the account (since RTP transport can be used by any accounts).
>>>
>>> So it's not possible to create specific RTP transport for specific
>>> account.
>>>
>>> -benny
>
>
> _______________________________________________
> Visit our blog: http://blog.pjsip.org
>
> pjsip mailing list
> pjsip@lists.pjsip.org
> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>
BP
Benny Prijono
Tue, Nov 13, 2007 4:19 PM
Hi Benny,
I created 2 rtp transports successfully, one each eth device. Now I have
a different problem. It seems to me that I can't have 2 calls at the
same time because only 1 stream is created. I checked the code and I
found a commentary in pjsua_media.c that says the following:
/* Create media session info based on SDP parameters.
- We only support one stream per session at the moment
*/
Is only one RTP stream supported? Is it possible to have more?
Sure! Otherwise why would we bother to have the conference bridge if
we only support 1 call? ;-)
The comment says "we can only support one stream per (media)
session", meaning 1 stream per call. It does not support, e.g.
audio and video streams on a single call, yet.
So there must be something wrong that you did that prevented
pjsua-lib from creating the second call.
-benny
jorge.amador@withus.pt wrote:
> Hi Benny,
>
> I created 2 rtp transports successfully, one each eth device. Now I have
> a different problem. It seems to me that I can't have 2 calls at the
> same time because only 1 stream is created. I checked the code and I
> found a commentary in pjsua_media.c that says the following:
>
> /* Create media session info based on SDP parameters.
> * We only support one stream per session at the moment
> */
>
> Is only one RTP stream supported? Is it possible to have more?
Sure! Otherwise why would we bother to have the conference bridge if
we only support 1 call? ;-)
The comment says "we can only support one stream per (media)
*session*", meaning 1 stream per call. It does not support, e.g.
audio and video streams on a single call, yet.
So there must be something wrong that you did that prevented
pjsua-lib from creating the second call.
-benny
> Jorge Amador
TV
Tomás Valenta
Tue, Nov 13, 2007 7:33 PM
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@pjsip.org
To: "pjsip embedded/DSP SIP discussion" pjsip@lists.pjsip.org
Sent: Tuesday, November 13, 2007 4:44 PM
Subject: Re: [pjsip] 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
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@pjsip.org>
To: "pjsip embedded/DSP SIP discussion" <pjsip@lists.pjsip.org>
Sent: Tuesday, November 13, 2007 4:44 PM
Subject: Re: [pjsip] 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
_______________________________________________
Visit our blog: http://blog.pjsip.org
pjsip mailing list
pjsip@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
BP
Benny Prijono
Wed, Nov 14, 2007 3:45 AM
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@pjsip.org
To: "pjsip embedded/DSP SIP discussion" pjsip@lists.pjsip.org
Sent: Tuesday, November 13, 2007 4:44 PM
Subject: Re: [pjsip] 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
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@pjsip.org>
> To: "pjsip embedded/DSP SIP discussion" <pjsip@lists.pjsip.org>
> Sent: Tuesday, November 13, 2007 4:44 PM
> Subject: Re: [pjsip] 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
TV
Tomás Valenta
Wed, Nov 14, 2007 8:21 PM
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@pjsip.org
To: "pjsip embedded/DSP SIP discussion" pjsip@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
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@pjsip.org
To: "pjsip embedded/DSP SIP discussion" pjsip@lists.pjsip.org
Sent: Tuesday, November 13, 2007 4:44 PM
Subject: Re: [pjsip] 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
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@pjsip.org>
To: "pjsip embedded/DSP SIP discussion" <pjsip@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
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@pjsip.org>
> To: "pjsip embedded/DSP SIP discussion" <pjsip@lists.pjsip.org>
> Sent: Tuesday, November 13, 2007 4:44 PM
> Subject: Re: [pjsip] 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
_______________________________________________
Visit our blog: http://blog.pjsip.org
pjsip mailing list
pjsip@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
BP
Benny Prijono
Fri, Nov 16, 2007 3:51 AM
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@pjsip.org
To: "pjsip embedded/DSP SIP discussion" pjsip@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
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@pjsip.org>
> To: "pjsip embedded/DSP SIP discussion" <pjsip@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
RK
Roland Klabunde
Fri, Nov 16, 2007 8:20 AM
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@pjsip.org
To: "pjsip embedded/DSP SIP discussion" pjsip@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@pjsip.org
To: "pjsip embedded/DSP SIP discussion" pjsip@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
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@pjsip.org>
To: "pjsip embedded/DSP SIP discussion" <pjsip@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@pjsip.org>
> To: "pjsip embedded/DSP SIP discussion" <pjsip@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@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
RK
Roland Klabunde
Fri, Nov 16, 2007 1:48 PM
May I ask that again?
Regards
----- Original Message -----
From: "Roland Klabunde" roland.klabunde@freenet.de
To: "pjsip embedded/DSP SIP discussion" pjsip@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@pjsip.org
To: "pjsip embedded/DSP SIP discussion" pjsip@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@pjsip.org
To: "pjsip embedded/DSP SIP discussion" pjsip@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
May I ask that again?
Regards
----- Original Message -----
From: "Roland Klabunde" <roland.klabunde@freenet.de>
To: "pjsip embedded/DSP SIP discussion" <pjsip@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@pjsip.org>
To: "pjsip embedded/DSP SIP discussion" <pjsip@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@pjsip.org>
> To: "pjsip embedded/DSP SIP discussion" <pjsip@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@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
_______________________________________________
Visit our blog: http://blog.pjsip.org
pjsip mailing list
pjsip@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
TV
Tomás Valenta
Fri, Nov 16, 2007 11:48 PM
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@freenet.de
To: "pjsip embedded/DSP SIP discussion" pjsip@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@freenet.de
To: "pjsip embedded/DSP SIP discussion" pjsip@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@pjsip.org
To: "pjsip embedded/DSP SIP discussion" pjsip@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@pjsip.org
To: "pjsip embedded/DSP SIP discussion" pjsip@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
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@freenet.de>
To: "pjsip embedded/DSP SIP discussion" <pjsip@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@freenet.de>
To: "pjsip embedded/DSP SIP discussion" <pjsip@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@pjsip.org>
To: "pjsip embedded/DSP SIP discussion" <pjsip@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@pjsip.org>
> To: "pjsip embedded/DSP SIP discussion" <pjsip@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@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
_______________________________________________
Visit our blog: http://blog.pjsip.org
pjsip mailing list
pjsip@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
_______________________________________________
Visit our blog: http://blog.pjsip.org
pjsip mailing list
pjsip@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org