Recent

Author Topic: PASCALMAIN does not exit  (Read 4924 times)

meanderix

  • Jr. Member
  • **
  • Posts: 50
PASCALMAIN does not exit
« on: July 21, 2012, 12:39:25 pm »
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: [Select]
{$ifdef ver2_5}
procedure PASCALMAIN; external name 'PASCALMAIN';

procedure FPC_SHARED_LIB_START; [public, alias: 'FPC_SHARED_LIB_START'];
begin
  PASCALMAIN;
end;
{$endif} 

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: [Select]
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)

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.
« Last Edit: July 21, 2012, 04:39:51 pm by meanderix »

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3541
Re: PASCALMAIN does not exit
« Reply #1 on: August 03, 2012, 08:45:18 am »
Unit initialization works for me using my compiler.

meanderix

  • Jr. Member
  • **
  • Posts: 50
Re: PASCALMAIN does not exit
« Reply #2 on: August 03, 2012, 09:06:13 am »
Unit initialization works for me using my compiler.

Did you try loading a shared object? I've not managed to make that work from within initialization.

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3541
Re: PASCALMAIN does not exit
« Reply #3 on: August 03, 2012, 09:11:57 am »
Did you try loading a shared object? I've not managed to make that work from within initialization.

Yes, I successfully loaded libsqlite. But that was done in response to a button press, not in the initialization.

meanderix

  • Jr. Member
  • **
  • Posts: 50
Re: PASCALMAIN does not exit
« Reply #4 on: August 03, 2012, 11:46:38 am »
Did you try loading a shared object? I've not managed to make that work from within initialization.

Yes, I successfully loaded libsqlite. But that was done in response to a button press, not in the initialization.
Right, it's strange that it works if you do it after initialization.

 

TinyPortal © 2005-2018