Forum > Android
PASCALMAIN does not exit
(1/1)
meanderix:
Hi,
I'm compiling the OpenGL ES 2.0 example with Free Pascal 2.5 and I'm trying to get unit initialization to work.
If I understand correctly, the following code is supposed to do the initialization:
--- Code: ---{$ifdef ver2_5}
procedure PASCALMAIN; external name 'PASCALMAIN';
procedure FPC_SHARED_LIB_START; [public, alias: 'FPC_SHARED_LIB_START'];
begin
PASCALMAIN;
end;
{$endif}
--- End code ---
I'm currently using the NoGUI widget set and I can see that FPC_SHARED_LIB_START is called. However, PASCALMAIN never exits. I don't know what is causing this or how to debug it. Any help would be much appreciated.
Update 1: if I remove the code for dynamically loading the OpenGL ES shared object then I get a different error:
--- Code: ---I/libgl2jni(12931): PASCALMAIN [1]
F/libc (12931): @@@ ABORTING: INVALID HEAP ADDRESS IN dlfree
F/libc (12931): Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1)
--- End code ---
Update 2: Ok, strangely the heap error went away if I removed 'Interfaces' from the library uses clause. So now unit initialization is working, but I can not use 'Interfaces' and I can not dynamically load the OpenGL ES 2.0 .so file (I can load it later though, in the JNI callback.)
Update 3: Seems the debug logger itself may have been responsible for some of the errors. Also, adding 'LCLProc' to the uses clause of some units may have changed the unit initialization order (?). I didn't find much documentation about the debug logger.
felipemdc:
Unit initialization works for me using my compiler.
meanderix:
--- Quote from: felipemdc on August 03, 2012, 08:45:18 am ---Unit initialization works for me using my compiler.
--- End quote ---
Did you try loading a shared object? I've not managed to make that work from within initialization.
felipemdc:
--- Quote from: meanderix on August 03, 2012, 09:06:13 am ---Did you try loading a shared object? I've not managed to make that work from within initialization.
--- End quote ---
Yes, I successfully loaded libsqlite. But that was done in response to a button press, not in the initialization.
meanderix:
--- Quote from: felipemdc on August 03, 2012, 09:11:57 am ---
--- Quote from: meanderix on August 03, 2012, 09:06:13 am ---Did you try loading a shared object? I've not managed to make that work from within initialization.
--- End quote ---
Yes, I successfully loaded libsqlite. But that was done in response to a button press, not in the initialization.
--- End quote ---
Right, it's strange that it works if you do it after initialization.
Navigation
[0] Message Index