Thanks Mike for the hint. I figured it out. To avoid this error, I need to wrap the part where we define the SWITCH_MODULE_..._FUNCTION inside SWITCH_BEGIN_EXTERN_C AND SWITCH_END_EXTERN_C.
It is now loaded fine. Regards Alex To -----Original Message----- From: freeswitch-dev-boun...@lists.freeswitch.org [mailto:freeswitch-dev-boun...@lists.freeswitch.org] On Behalf Of Michael Giagnocavo Sent: Wednesday, November 04, 2009 8:30 PM To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] FW: Visual Studio 2008 Pro SP1: switch_loadable_module.c:871 Error Loading module .... **dll sym error [127l] mod_managed is C++ and builds and loads fine. You could look at that and compare options and code. (Actually, all of the language plugins should be C++.) -Michael -----Original Message----- From: freeswitch-dev-boun...@lists.freeswitch.org [mailto:freeswitch-dev-boun...@lists.freeswitch.org] On Behalf Of Alex To Sent: Wednesday, November 04, 2009 5:02 AM To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] FW: Visual Studio 2008 Pro SP1: switch_loadable_module.c:871 Error Loading module .... **dll sym error [127l] Anyone out there have built and loaded successfully a C++ module using Visual Studio 2008 SP1 with FS? This error really got me frustrated these few days. I can't seem to load a C++ module in FS, the error is "dll sym error [1271]" If I rename the code file to .c or change the compile option to "Compile as C code", the module loads fine. If I compile using option "Compile as C++ code" then I got the error. Would really appreciate it if anyone could shed some lights. It must be a setting somewhere in VS or in FS ?? I build FS on Windows 7 x64, VS 2008 SP1, Windows SDK 7.0, build target win32. Regards Alex To -----Original Message----- From: freeswitch-dev-boun...@lists.freeswitch.org [mailto:freeswitch-dev-boun...@lists.freeswitch.org] On Behalf Of Giovanni Maruzzelli Sent: Sunday, November 01, 2009 9:05 PM To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] FW: Visual Studio 2008 Pro SP1: switch_loadable_module.c:871 Error Loading module .... **dll sym error [127l] On Sun, Nov 1, 2009 at 12:44 PM, Alex To <tonhud...@gmail.com> wrote: > Sorry, I figured it out by myself. It was because my code file is > mod_mymodule.cpp. I changed it to mod_mymodule.c and the module loaded file. > So I take it as FS accepts only C library but not C++ ? Ciao Alex, no, you're on the wrong track. FS loads CPP modules. Your problems probably come because mod_skel is a C module, and the Makefile for it manages it as a C module. If you want to compile a CPP module, find one as an example, and adjust yourmodule and its Makefile to be compiled in a similar way. I've done it, and I can assure it works. In this moment I cannot tell you out of my memory which module is CPP, but just browse the sources looking for *.cc or *.cpp. -giovanni > > > > Regards > > > > Alex To > > > > From: Alex To [mailto:tonhud...@gmail.com] > Sent: Sunday, November 01, 2009 7:35 PM > To: 'freeswitch-dev@lists.freeswitch.org' > Subject: Visual Studio 2008 Pro SP1: switch_loadable_module.c:871 Error > Loading module .... **dll sym error [127l] > > > > Hi, excuse me if this is already asked where else but I did browse through > the mailing list and I couldn't find anything related. I tried to create a > new end point module by copying the mod_skel to mod/endpoints/my_module > folder. > > > > I modified "skel" to my module name and basically I leave no codes in the > load function, just a few lines to test if the new module is working. These > few lines are: > > > > *module_interface = switch_loadable_module_create_module_interface(pool, > modname); > > modem_endpoint_interface = > (switch_endpoint_interface_t*)switch_loadable_module_create_interface(*modul e_interface, > SWITCH_ENDPOINT_INTERFACE); > > modem_endpoint_interface->interface_name = "modem"; > > switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Hello > World!\n"); > > // > > //do_config(SWITCH_FALSE); > > // > > SWITCH_ADD_API(api_interface, "modem", "Modem API", modem_function, > "syntax"); > > > > /* indicate that the module should continue to be loaded */ > > return SWITCH_STATUS_SUCCESS; > > > > It compiles but the module can't load properly. I received the following > error: > > > > 2009-11-01 19:18:10.551180 [CRIT] switch_loadable_module.c:871 Error Loading > module D:\Projects\freeswitch\Debug\mod\mod_mymodule.dll > > **dll sym error [127l] > > ** > > I tried to load module normally at the FS console but "load mod_skel" and > "load mod_mymodule" gives the same error. > > > > Would someone tell me what do I miss here. > > > > Btw, I looked at mod_sofia and mod_iax, this line of code could compile in > those 2 modules. > > > > modem_endpoint_interface = > switch_loadable_module_create_interface(*module_interface, > SWITCH_ENDPOINT_INTERFACE); > > > > The same line of code couldn't compile in my module coz VS complains: cannot > convert from void* to switch_endpoint_interface_t*. I know C++ require more > type-safe conversion than C but anyone got the same error? > > > > And how would I search in the mailing list ? Sorry for this dumb question > but I can't seem to find out how to search in the archives. For now, before > posting anything, I need to try to browse through all the postings first, > which is > > > > quite tedious to do. > > > > Regards > > > > Alex To > > _______________________________________________ > FreeSWITCH-dev mailing list > FreeSWITCH-dev@lists.freeswitch.org > http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev > UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev > http://www.freeswitch.org > > -- Sincerely, Giovanni Maruzzelli Cell : +39-347-2665618 _______________________________________________ FreeSWITCH-dev mailing list FreeSWITCH-dev@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev http://www.freeswitch.org _______________________________________________ FreeSWITCH-dev mailing list FreeSWITCH-dev@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev http://www.freeswitch.org _______________________________________________ FreeSWITCH-dev mailing list FreeSWITCH-dev@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev http://www.freeswitch.org _______________________________________________ FreeSWITCH-dev mailing list FreeSWITCH-dev@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev http://www.freeswitch.org