[fpc-pascal] Mozilla XPCOM

José Mejuto joshyfun at gmail.com
Thu Jun 3 00:02:06 CEST 2010


Hello FPC-Pascal,

I'm trying to make the Gecko engine port compile in Ubuntu. It
currently works in Win32 without problems, but in Ubuntu I had found a
strange problem that could be related to fpc or not.

Mozilla XPCOM is more or less based in COM interfaces, so in simple
words, the code loads the libxpcom.so file, get some function pointers
from it and call a function that returns an interface and later this
interface is used to create a new interface. Example:

var
  ServiceManager: nsIServiceManager;
  WindowWatcher: nsIWindowWatcher;
begin
  xpcomfuncGetServicemanager(ServiceManager);
  ServiceManager.GetServiceByContractID('@mozilla/...;1',nsIWindowWatcher,WindowWatcher);
end;

Everything seems to work up to this point, where something strange
happends, I get the ServiceManager interface and it looks fine, up to
where gdb let me see (non nil) and when calling
.GetServiceByContractID execution stops, but it stops "clean", no
SIGSGV, no exception, nothing. My first idea was that the function due
some kind of error calls halt or any processor instruction that
cancels execution, but when compiled with heaptrc I get the heaptrc
dump, which should not happend if the stop were abnormal.

All interfaces are safecall and I'm using up to date fpc 2.5.1.

Does anybody have a remote idea of what could be happening ? Any idea
about how to debug the reason of the sudden stop ? Maybe COM style
interfaces can not be used in Linux ?

If anybody wants to try it in the own computer I can upload the
current version to the Lazarus CCR "gecko port", the current one does
not compile in Linux, only win32.

-- 
Best regards,
 José




More information about the fpc-pascal mailing list