Am Dienstag, 8. März 2016 13:40:12 UTC+1 schrieb Kyle Huey: > You're probably just not linking to the xpcom glue library in eclipse/gcc. > > - Kyle > > On Tue, Mar 8, 2016 at 8:33 PM, Tobias Wolf wrote: > > > We`re develping a PKCS11 modul in c/c++ for a custom card reader to > > support. I just want to display a simple dialog. The code below works great > > until I stay on MS Visual Studio. But our project is running on eclipse/gcc. > > > > nsCOMPtr<nsIPromptService> promptService = do_GetService("@ > > mozilla.org/embedcomp/prompt-service;1")); > > promptService->Alert(NULL, NULL, NULL); > > > > I`m getting the following error during linking, that comes because of the > > different coding convention between VS and mingw/gcc on windows. > > > > C:/download/xulrunner-41.0b9.en-US.win64.sdk/xulrunner-sdk/include/nsCOMPtr.h:514: > > undefined reference to > > `nsCOMPtr_base::assign_from_gs_contractid(nsGetServiceByContractID, nsID > > const&)' > > > > Am Montag, 7. März 2016 18:50:36 UTC+1 schrieb Benjamin Smedberg: > > > On 3/7/2016 11:17 AM, Tobias Wolf wrote: > > > > I try to call this code dynamically: > > > > > > > > nsCOMPtr<nsIPromptService> promptService = do_GetService("@ > > mozilla.org/embedcomp/prompt-service;1")); > > > > promptService->Alert(NULL, NULL, NULL); > > > > > > > > I do the following: > > > > > > > > nsISomeInterface* mXPTCStub; > > > > nsresult rc; > > > > nsXPTCVariant params[3]; > > > > > > Why are you trying to do this? Are you writing a shim layer that > > > connects some other dynamic/scripting language to XPCOM? > > > > > > > > > > > rc = NS_GetXPTCallStub(NS_IPROMPTSERVICE_IID, proxy, &mXPTCStub); > > > > > > > > params[0].val.p = NULL; > > > > params[0].type = nsXPTType::T_VOID; > > > > params[0].flags = 0; > > > > > > > > params[1].val.p = (void*)title; > > > > params[1].type = nsXPTType::T_CHAR_STR; > > > > params[1].flags = 0; > > > > > > > > params[2].val.p = (void*)text; > > > > params[2].type = nsXPTType::T_CHAR_STR; > > > > params[2].flags = 0; > > > > > > > > rc = NS_InvokeByIndex(mXPTCStub, 1, 3, params); > > > > NS_DestroyXPTCallStub(mXPTCStub); > > > > > > > > But I don`t know how to use NS_GetXPTCallStub! > > > > What means the second and third parameter from NS_GetXPTCallStub? > > > > > > Have you read the doccomments at > > > > > http://mxr.mozilla.org/mozilla-central/source/xpcom/reflect/xptcall/xptcall.h#174 > > > ? > > > > > > If you are trying to *invoke* a method, you don't need an xptcall stub > > > at all. You just need NS_InvokeByIndex. > > > > > > An XPTCall stub is used to *implement* an XPCOM object whose > > > type/interface definition isn't known at compile time, typically by > > > mirroring it to an underlying scriptable object. You would need to > > > implement a c++ class which implements nsIXPTCProxy and implements > > > CallMethod. > > > > > > --BDS > > _______________________________________________ > > dev-platform mailing list > > dev-platform@lists.mozilla.org > > https://lists.mozilla.org/listinfo/dev-platform > >
This is my full gcc output, as you see I`m linking again -llibxpcomglue and -lxul, all methods are found, only the com pointer c++ class not. g++ "-LC:\\Daten\\_projects\\sourcecode\\trunk\\Auth-Client\\src\\main\\resources\\win32-x86-64" -shared -o libAuth-Client.dll "src\\main\\cpp\\ac_ffplugin.o" "src\\main\\cpp\\ac_locking.o" "src\\main\\cpp\\ac_log.o" "src\\main\\cpp\\ac_openssl.o" "src\\main\\cpp\\ac_openssl_util.o" "src\\main\\cpp\\ac_ui.o" "src\\main\\cpp\\ac_webservice.o" "src\\main\\cpp\\ac_xmlconfig.o" "src\\main\\cpp\\stdsoap2.o" "src\\main\\cpp\\webservice\\CertificateServiceClientLib.o" "src\\main\\cpp\\webservice\\EventServiceClientLib.o" "src\\main\\cpp\\webservice\\SignatureServiceClientLib.o" "src\\main\\cpp\\webservice\\envC.o" -llibxpcomglue -lxul -llibxml2-2 -llibeay32 -lssleay32 -llibcharset-1 -llibexpat-1 -llibiconv-2 -lliblog4c-3 -lzlib1 -lws2_32 src\main\cpp\ac_ui.o: In function `nsCOMPtr<nsIPromptService>::nsCOMPtr(nsGetServiceByContractID)': C:/download/xulrunner-41.0b9.en-US.win64.sdk/xulrunner-sdk/include/nsCOMPtr.h:514: undefined reference to `nsCOMPtr_base::assign_from_gs_contractid(nsGetServiceByContractID, nsID const&)' collect2.exe: error: ld returned 1 exit status _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform