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 <wolf.tob...@gmx.net> 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 > _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform