Hi Hesham, I was too brief describing the last step. You must make getopt.h and getopt.c look like other PJLIB headers, sources. I.e. begin getopt.h with PJ_BEGIN_DECL (I think you have to #include <pj/config.h>, if it is not) and end with PJ_END_DECL. All public declarations must be made using PJ_DECL or PJ_DECL_DATA macros. Symbols declared in such way must be defined using PJ_DEF or PJ_DEF_DATA respectively in getopt.c. I do not know why, but I experienced this was not enough. Adding _pj_getopt_long to Force reference symbols linker option at PJSUA_LIB project does the job. I would like to suggest this patch to be merged with the trunk source code. Maybe it is just a problem of Visual Studio but the proposed changes are harmless on other platforms. Vali Dne 12.1.2011 10:16, Hesham Abboud napsal(a): > Hi Vali, > > Thanks a lot for your reply, it really helped, > > but, when i tried to make the steps 5, 6 and 7, 4 external link errors > didn't want to be resolved. i tried googling them but couldn't find any > help, i'll show them below, also, when u wrote in step 6 > "pjmedia/src/pjmedia/enpoint.c:52 Use PJ_DEF_DATA", did u mean to make > the line like this > PJ_DEF_DATA(pj_bool_t) pjmedia_add_rtpmap_for_static_pt = > or what because i didn't understand it so well? > > the errors are: > > Error1error LNK2001: unresolved external symbol > _pj_getopt_longpjsua_app.objpjsua > Error2error LNK2019: unresolved external symbol _pj_optarg referenced in > function _parse_argspjsua_app.objpjsua > Error3error LNK2019: unresolved external symbol _pj_optind referenced in > function _parse_argspjsua_app.objpjsua > Error4fatal error LNK1120: 3 unresolved > externals..\bin\pjsua-i386-Win32-vc8-Release-Dynamic.exepjsua > > > On Mon, Jan 10, 2011 at 11:54 PM, Tom?? Valenta <vali at kamarad.cz > <mailto:vali at kamarad.cz>> wrote: > > Hi Hesham, > > it looks like you do not link with WinSock, add ws2_32.lib and/or > wsock.lib or something like that. It should be first link in google. > > Cheers > - Vali > > PS. Benny, in case you read this conversation, aren't you interested > in applying suggested patch to be able to build PJSUA using > pjsua_lib.dll easily? > > > Dne 10.1.2011 14:53, Hesham Abboud napsal(a): > > Hi Tomas, > > I'm developing a SIP phone on windows mobile for my company. After > searching a lot, I found the only project which done the same thing > using pjsip is Sipek project. Also the project made a dll file > wrapping > pjsip and used it. The problem is that, the working in the > project has > been stopped for over a year now and the dll file was made about > 2 years > ago, so I can't use it effectively or modify in it. For these > reasons I > decided to make my own dll file. Searching for how to do so > showed me ur > e-mail so I tried to do the steps u mentioned. I made the steps > 1, 2 and > 3 but unfortunately a list of errors appeared and building > failed. I'll > list the errors below, but do u have any suggestions on how to > approach > what I want? > > thanks in advance > > Error18error LNK2019: unresolved external symbol __imp__ntohs at 4 > referenced in function > _pj_ntohspjlib-i386-win32-vc8-release-dynamic.libpjsua_lib > Error19error LNK2001: unresolved external symbol > __imp__ntohs at 4libsrtp-i386-win32-vc8-release-dynamic.libpjsua_lib > Error20error LNK2019: unresolved external symbol __imp__htons at 4 > referenced in function > _pj_htonspjlib-i386-win32-vc8-release-dynamic.libpjsua_lib > Error21error LNK2001: unresolved external symbol > __imp__htons at 4libsrtp-i386-win32-vc8-release-dynamic.libpjsua_lib > Error22error LNK2019: unresolved external symbol __imp__ntohl at 4 > referenced in function > _pj_ntohlpjlib-i386-win32-vc8-release-dynamic.libpjsua_lib > Error23error LNK2001: unresolved external symbol > __imp__ntohl at 4libsrtp-i386-win32-vc8-release-dynamic.libpjsua_lib > Error24error LNK2001: unresolved external symbol > __imp__ntohl at 4libsrtp-i386-win32-vc8-release-dynamic.libpjsua_lib > Error25error LNK2001: unresolved external symbol > __imp__ntohl at 4libsrtp-i386-win32-vc8-release-dynamic.libpjsua_lib > Error26error LNK2019: unresolved external symbol __imp__htonl at 4 > referenced in function > _pj_htonlpjlib-i386-win32-vc8-release-dynamic.libpjsua_lib > Error27error LNK2001: unresolved external symbol > __imp__htonl at 4libsrtp-i386-win32-vc8-release-dynamic.libpjsua_lib > Error28error LNK2001: unresolved external symbol > __imp__htonl at 4libsrtp-i386-win32-vc8-release-dynamic.libpjsua_lib > Error29error LNK2019: unresolved external symbol __imp__inet_ntoa at 4 > referenced in function > _pj_inet_ntoapjlib-i386-win32-vc8-release-dynamic.libpjsua_lib > Error30error LNK2019: unresolved external symbol __imp__inet_addr at 4 > referenced in function > _pj_inet_atonpjlib-i386-win32-vc8-release-dynamic.libpjsua_lib > Error31error LNK2019: unresolved external symbol > > __imp__WSAStringToAddressA at 20 referenced in function > _pj_inet_ptonpjlib-i386-win32-vc8-release-dynamic.libpjsua_lib > Error32error LNK2019: unresolved external symbol > > __imp__WSAAddressToStringA at 20 referenced in function > _pj_inet_ntoppjlib-i386-win32-vc8-release-dynamic.libpjsua_lib > Error33error LNK2019: unresolved external symbol > __imp__gethostname at 8 > referenced in function > _pj_gethostnamepjlib-i386-win32-vc8-release-dynamic.libpjsua_lib > Error34error LNK2019: unresolved external symbol > > __imp__WSAGetLastError at 0 referenced in function > _pj_sock_socketpjlib-i386-win32-vc8-release-dynamic.libpjsua_lib > Error35error LNK2001: unresolved external symbol > __imp__WSAGetLastError at 0pjlib-i386-win32-vc8-release-dynamic.libpjsua_lib > Error36error LNK2001: unresolved external symbol > __imp__WSAGetLastError at 0pjlib-i386-win32-vc8-release-dynamic.libpjsua_lib > Error37error LNK2019: unresolved external symbol > __imp__WSASocketA at 24 > referenced in function > _pj_sock_socketpjlib-i386-win32-vc8-release-dynamic.libpjsua_lib > Error38error LNK2019: unresolved external symbol __imp__bind at 12 > referenced in function > _pj_sock_bindpjlib-i386-win32-vc8-release-dynamic.libpjsua_lib > Error39error LNK2019: unresolved external symbol > __imp__closesocket at 4 > referenced in function > _pj_sock_closepjlib-i386-win32-vc8-release-dynamic.libpjsua_lib > Error40error LNK2019: unresolved external symbol > __imp__getpeername at 12 > referenced in function > _pj_sock_getpeernamepjlib-i386-win32-vc8-release-dynamic.libpjsua_lib > Error41error LNK2019: unresolved external symbol > __imp__getsockname at 12 > referenced in function > _pj_sock_getsocknamepjlib-i386-win32-vc8-release-dynamic.libpjsua_lib > Error42error LNK2019: unresolved external symbol __imp__send at 16 > referenced in function > _pj_sock_sendpjlib-i386-win32-vc8-release-dynamic.libpjsua_lib > Error43error LNK2019: unresolved external symbol __imp__sendto at 24 > referenced in function > _pj_sock_sendtopjlib-i386-win32-vc8-release-dynamic.libpjsua_lib > Error44error LNK2019: unresolved external symbol __imp__recv at 16 > referenced in function > _pj_sock_recvpjlib-i386-win32-vc8-release-dynamic.libpjsua_lib > Error45error LNK2019: unresolved external symbol __imp__recvfrom at 24 > referenced in function > _pj_sock_recvfrompjlib-i386-win32-vc8-release-dynamic.libpjsua_lib > Error46error LNK2019: unresolved external symbol > __imp__getsockopt at 20 > referenced in function > _pj_sock_getsockoptpjlib-i386-win32-vc8-release-dynamic.libpjsua_lib > Error47error LNK2019: unresolved external symbol > __imp__setsockopt at 20 > referenced in function > _pj_sock_setsockoptpjlib-i386-win32-vc8-release-dynamic.libpjsua_lib > Error48error LNK2019: unresolved external symbol __imp__connect at 12 > referenced in function > _pj_sock_connectpjlib-i386-win32-vc8-release-dynamic.libpjsua_lib > Error49error LNK2019: unresolved external symbol __imp__shutdown at 8 > referenced in function > _pj_sock_shutdownpjlib-i386-win32-vc8-release-dynamic.libpjsua_lib > Error50error LNK2019: unresolved external symbol __imp__listen at 8 > referenced in function > _pj_sock_listenpjlib-i386-win32-vc8-release-dynamic.libpjsua_lib > Error51error LNK2019: unresolved external symbol __imp__accept at 12 > referenced in function > _pj_sock_acceptpjlib-i386-win32-vc8-release-dynamic.libpjsua_lib > Error52error LNK2019: unresolved external symbol __imp__WSAStartup at 8 > referenced in function > _pj_initpjlib-i386-win32-vc8-release-dynamic.libpjsua_lib > Error53error LNK2019: unresolved external symbol __imp__WSACleanup at 0 > referenced in function > _pj_shutdownpjlib-i386-win32-vc8-release-dynamic.libpjsua_lib > Error54error LNK2019: unresolved external symbol > > __imp__WSASetLastError at 4 referenced in function > _pj_set_netos_errorpjlib-i386-win32-vc8-release-dynamic.libpjsua_lib > Error55error LNK2019: unresolved external symbol > __imp__gethostbyname at 4 > referenced in function > _pj_gethostbynamepjlib-i386-win32-vc8-release-dynamic.libpjsua_lib > Error56error LNK2019: unresolved external symbol > __imp__ioctlsocket at 12 > referenced in function > _pj_ioqueue_register_sockpjlib-i386-win32-vc8-release-dynamic.libpjsua_lib > Error57error LNK2019: unresolved external symbol ___WSAFDIsSet at 8 > referenced in function > _PJ_FD_ISSETpjlib-i386-win32-vc8-release-dynamic.libpjsua_lib > Error58error LNK2019: unresolved external symbol __imp__select at 20 > referenced in function > _pj_sock_selectpjlib-i386-win32-vc8-release-dynamic.libpjsua_lib > Error59fatal error LNK1120: 32 unresolved > externals..\bin\pjsua_lib-i386-Win32-vc8-Release-Dynamic.exepjsua_lib > > > > On Tue, Dec 14, 2010 at 9:41 PM, Tom?? Valenta <vali at kamarad.cz > <mailto:vali at kamarad.cz> > <mailto:vali at kamarad.cz <mailto:vali at kamarad.cz>>> wrote: > > Hi, > > recently I tried to compile pjsua_lib 1.8.10 as a single DLL for > using in our application. We are migrating from 1.0.3. > Everything > went fairly OK with some obstacles, though. Here I would like to > write down the steps I made and fixes if there were problems. > > 1. Opened in Visual Studio 2008, chosen Release-Dynamic > configuration on Win32 platform. > 2. Put following in config_site.h: > #define PJ_DLL 1 > #ifdef _LIB > # define PJ_EXPORTING 1 > #endif > 3. Set dependencies of pjsua_lib to the same as libpjproject > and set > its configuration type to DLL. Also added > _pjmedia_tonegen_create2 > to Force reference symbols in linker options, because this > symbol > would not be available otherwise. > 4. Built pjsua_lib project. This was enough for our application > needs, but to make PJSUA using this DLL following steps must > be taken: > > 5. Set PJSUA's dependencies to pjsua_lib only. Now when tried to > build PJSUA, following Unresolved externals appeared: > _pjmedia_add_rtpmap_for_static_pt > _pjsip_include_allow_hdr_in_dlg > _pjsip_use_compact_form > _pj_optarg > _pj_getopt_long > _pj_optind > (And also some _pjmedia_tonegen_... if not set in step 3.) > > 6. Following lines must be patched: > pjmedia/src/pjmedia/enpoint.c:52 Use PJ_DEF_DATA > pjsip/src/pjsip/sip_dialog.c:44 Use PJ_DEF_DATA > pjsip/src/pjsip/sip_msg.c:147 Use PJ_DEF_DATA > pjsip-apps/src/pjsua/pjsua_app.c:962--964 Use PJ_DECL_DATA > pjsip-apps/src/pjsua/pjsua_app.c:1676 Use PJ_DECL_DATA > Also add PJ_DECL and PJ_DEF macros to > pjlib-util/src/pjlib-util/getopt.* > And put to the PJSUA's Force reference symbols also > _pj_getopt_long. > > 7. Now PJSUA compiles and works correctly. > > I hope this post will be useful for someone and the suggested > patches will be applied to the trunk, because I think this > is the > way it should be done, but correct me if I am wrong. > > Cheers, > - Vali > > PS. Have you any idea, why "Force reference symbols" must be set > sometimes? > > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip at lists.pjsip.org <mailto:pjsip at lists.pjsip.org> > <mailto:pjsip at lists.pjsip.org <mailto:pjsip at lists.pjsip.org>> > > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org > > > > > -- > Eng. Hesham Abboud > +20123185749 > > > > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip at lists.pjsip.org <mailto: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 <mailto:pjsip at lists.pjsip.org> > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org > > > > > -- > Eng. Hesham Abboud > +20123185749 > > > > _______________________________________________ > 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