2008/2/21, Alban Crequy <[EMAIL PROTECTED]>:
>  I am trying to use sofia-sip on symbian. I am using
>  S60_3rd_Ed_SDK_FP2_Beta_b and compiling using the WINSCW compiler for
>  the emulator.
>
>  The project compiles correctly but when I am trying to run
>  test_nua.exe, I have some issues.
>
>  The test suite programs use symbols exported by the libsofia-sip-ua
>  DLL. The test suite .mmp files contains "MACRO IN_LIBSOFIA_SIP_UA". It
>  controls whether SOFIAPUBVAR extends to __declspec(dllimport) or
>  __declspec(dllexport). The .dll should use dllexport to export a symbol
>  and the .exe should use dllimport to use a symbol from the .dll.
>
>  However both .mmp file for the dll and .mmp file for the test suite
>  define the "MACRO IN_LIBSOFIA_SIP_UA". So it uses
>  "__declspec(dllexport)" both in the .dll and in the .exe. IHMO this is
>  a bug in the .mmp files.

You are correct. I wonder how we got test_nua ever working... ;-)

>  The symptom is that the application crashes when it try to access to
>  the "nua_log" variable. This variable is exported by the
>  libsofia-sip-ua.dll and used by test_nua.exe.
>
>  I tried to fix it but then test_nua.exe just crashes as soon as it gets
>  started. My breakpoint in the main() function is not triggered: it
>  crashes before the main() function. I reduced this problem to a small
>  program (43 lines), and reported it there:
>
>  http://discussion.forum.nokia.com/forum/showthread.php?t=127457
>
>  In short, when we access a variable exported from the dll and use it to
>  initialize a local variable, it crashes. This pattern does not work, I
>  don't know why.

I think the static variable is initialized before the DLL linkage is
complete. The additional complication is that Sofia SIP DLL exports an
array or struct but Symbian (and Windows) DLL linkage does not support
them, it supports just pointers. The __declspec() magic is implemented
badly in the Symbian compilers (not to speak about Windows), so they
may end up of using the pointer to the pointer to the array/struct
where they should just use pointer to the array/struct.

It seems to me that Martti just avoids static initialization with
pointers from DLL.

>  But this pattern is used a lot in sofia-sip. I don't know whether
>  changing this pattern is the right thing to do. Maybe it is a bug in
>  the compiler, epoc, or whatever and we should fix the real bug instead.
>  (?)
>
>  For example, see:
>  ./libsofia-sip-ua/nua/test_nua_params.c line 59 that uses NUTAG_ANY,
>  which is a macro expanding to symbol nutag_any from the dll.

I think this particular example should work without problems
(assuming, of course, that you have fixed the IN_LIBSOFIA_SIP_UA). Or
then the __declspec() magic breaks in even worse way on Symbian than
on Windows.

-- 
Pekka.Pessi mail at nokia.com

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel

Reply via email to