Hi Nicolas
On a related note, I decided to check with valgrind, this output is
from a standard neko 1.6 on ubuntu. I don't know how to interpret the
results but maybe it's of interest to you. This has nothing to do with
pascal it's just doing a trace('blah'), but valgrind does seem to have an
issue with it
==12881== Process terminating with default action of signal 11 (SIGSEGV)
==12881== Access not within mapped region at address 0xBEEFE05C
here's the rest ....
[EMAIL PROTECTED]:~/haXe/Projects/hxPascal$ valgrind neko Tests.n
==12881== Memcheck, a memory error detector.
==12881== Copyright (C) 2002-2006, and GNU GPL'd, by Julian Seward et al.
==12881== Using LibVEX rev 1658, a library for dynamic binary translation.
==12881== Copyright (C) 2004-2006, and GNU GPL'd, by OpenWorks LLP.
==12881== Using valgrind-3.2.1-Debian, a dynamic binary instrumentation framewo.
==12881== Copyright (C) 2000-2006, and GNU GPL'd, by Julian Seward et al.
==12881== For more details, rerun with: -v
==12881==
==12881== Conditional jump or move depends on uninitialised value(s)
==12881== at 0x41C38CB: GC_push_all_eager (in /usr/lib/libgc.so.1.0.2)
==12881== by 0x41C536E: GC_push_current_stack (in /usr/lib/libgc.so.1.0.2)
==12881== by 0x41CCCF2: GC_with_callee_saves_pushed (in /usr/lib/libgc.so.1.)
==12881== by 0x41CCD36: GC_generic_push_regs (in /usr/lib/libgc.so.1.0.2)
==12881== by 0x41C54CA: GC_push_roots (in /usr/lib/libgc.so.1.0.2)
==12881== by 0x41C4D26: GC_mark_some (in /usr/lib/libgc.so.1.0.2)
==12881== by 0x41BC75A: GC_stopped_mark (in /usr/lib/libgc.so.1.0.2)
==12881== by 0x41BCB0B: GC_try_to_collect_inner (in /usr/lib/libgc.so.1.0.2)
==12881== by 0x41C6C3D: GC_init_inner (in /usr/lib/libgc.so.1.0.2)
==12881== by 0x41C6E44: GC_init (in /usr/lib/libgc.so.1.0.2)
==12881== by 0x4028CA3: neko_gc_init (in /usr/lib/libneko.so)
==12881==
==12881== Conditional jump or move depends on uninitialised value(s)
==12881== at 0x41C38D0: GC_push_all_eager (in /usr/lib/libgc.so.1.0.2)
==12881== by 0x41C536E: GC_push_current_stack (in /usr/lib/libgc.so.1.0.2)
==12881== by 0x41CCCF2: GC_with_callee_saves_pushed (in /usr/lib/libgc.so.1.)
==12881== by 0x41CCD36: GC_generic_push_regs (in /usr/lib/libgc.so.1.0.2)
==12881== by 0x41C54CA: GC_push_roots (in /usr/lib/libgc.so.1.0.2)
==12881== by 0x41C4D26: GC_mark_some (in /usr/lib/libgc.so.1.0.2)
==12881== by 0x41BC75A: GC_stopped_mark (in /usr/lib/libgc.so.1.0.2)
==12881== by 0x41BCB0B: GC_try_to_collect_inner (in /usr/lib/libgc.so.1.0.2)
==12881== by 0x41C6C3D: GC_init_inner (in /usr/lib/libgc.so.1.0.2)
==12881== by 0x41C6E44: GC_init (in /usr/lib/libgc.so.1.0.2)
==12881== by 0x4028CA3: neko_gc_init (in /usr/lib/libneko.so)
==12881==
==12881== Conditional jump or move depends on uninitialised value(s)
==12881== at 0x41C4451: GC_mark_from (in /usr/lib/libgc.so.1.0.2)
==12881== by 0x41C4C2F: GC_mark_some (in /usr/lib/libgc.so.1.0.2)
==12881== by 0x41BC75A: GC_stopped_mark (in /usr/lib/libgc.so.1.0.2)
==12881== by 0x41BCB0B: GC_try_to_collect_inner (in /usr/lib/libgc.so.1.0.2)
==12881== by 0x41C6C3D: GC_init_inner (in /usr/lib/libgc.so.1.0.2)
==12881== by 0x41C6E44: GC_init (in /usr/lib/libgc.so.1.0.2)
==12881== by 0x4028CA3: neko_gc_init (in /usr/lib/libneko.so)
==12881==
==12881== Conditional jump or move depends on uninitialised value(s)
==12881== at 0x41C447C: GC_mark_from (in /usr/lib/libgc.so.1.0.2)
==12881== by 0x41C4C2F: GC_mark_some (in /usr/lib/libgc.so.1.0.2)
==12881== by 0x41BC75A: GC_stopped_mark (in /usr/lib/libgc.so.1.0.2)
==12881== by 0x41BCB0B: GC_try_to_collect_inner (in /usr/lib/libgc.so.1.0.2)
==12881== by 0x41C6C3D: GC_init_inner (in /usr/lib/libgc.so.1.0.2)
==12881== by 0x41C6E44: GC_init (in /usr/lib/libgc.so.1.0.2)
==12881== by 0x4028CA3: neko_gc_init (in /usr/lib/libneko.so)
==12881==
==12881== Conditional jump or move depends on uninitialised value(s)
==12881== at 0x41C4459: GC_mark_from (in /usr/lib/libgc.so.1.0.2)
==12881== by 0x41C4C2F: GC_mark_some (in /usr/lib/libgc.so.1.0.2)
==12881== by 0x41BC75A: GC_stopped_mark (in /usr/lib/libgc.so.1.0.2)
==12881== by 0x41BCB0B: GC_try_to_collect_inner (in /usr/lib/libgc.so.1.0.2)
==12881== by 0x41C6C3D: GC_init_inner (in /usr/lib/libgc.so.1.0.2)
==12881== by 0x41C6E44: GC_init (in /usr/lib/libgc.so.1.0.2)
==12881== by 0x4028CA3: neko_gc_init (in /usr/lib/libneko.so)
==12881==
==12881== Conditional jump or move depends on uninitialised value(s)
==12881== at 0x41C4484: GC_mark_from (in /usr/lib/libgc.so.1.0.2)
==12881== by 0x41C4C2F: GC_mark_some (in /usr/lib/libgc.so.1.0.2)
==12881== by 0x41BC75A: GC_stopped_mark (in /usr/lib/libgc.so.1.0.2)
==12881== by 0x41BCB0B: GC_try_to_collect_inner (in /usr/lib/libgc.so.1.0.2)
==12881== by 0x41C6C3D: GC_init_inner (in /usr/lib/libgc.so.1.0.2)
==12881== by 0x41C6E44: GC_init (in /usr/lib/libgc.so.1.0.2)
==12881== by 0x4028CA3: neko_gc_init (in /usr/lib/libneko.so)
==12881==
==12881== Invalid read of size 4
==12881== at 0x41C443D: GC_mark_from (in /usr/lib/libgc.so.1.0.2)
==12881== by 0x41C4C2F: GC_mark_some (in /usr/lib/libgc.so.1.0.2)
==12881== by 0x41BC75A: GC_stopped_mark (in /usr/lib/libgc.so.1.0.2)
==12881== by 0x41BCB0B: GC_try_to_collect_inner (in /usr/lib/libgc.so.1.0.2)
==12881== by 0x41C6C3D: GC_init_inner (in /usr/lib/libgc.so.1.0.2)
==12881== by 0x41C6E44: GC_init (in /usr/lib/libgc.so.1.0.2)
==12881== by 0x4028CA3: neko_gc_init (in /usr/lib/libneko.so)
==12881== Address 0xBEEFE05C is not stack'd, malloc'd or (recently) free'd
==12881==
==12881== Process terminating with default action of signal 11 (SIGSEGV)
==12881== Access not within mapped region at address 0xBEEFE05C
==12881== at 0x41C443D: GC_mark_from (in /usr/lib/libgc.so.1.0.2)
==12881== by 0x41C4C2F: GC_mark_some (in /usr/lib/libgc.so.1.0.2)
==12881== by 0x41BC75A: GC_stopped_mark (in /usr/lib/libgc.so.1.0.2)
==12881== by 0x41BCB0B: GC_try_to_collect_inner (in /usr/lib/libgc.so.1.0.2)
==12881== by 0x41C6C3D: GC_init_inner (in /usr/lib/libgc.so.1.0.2)
==12881== by 0x41C6E44: GC_init (in /usr/lib/libgc.so.1.0.2)
==12881== by 0x4028CA3: neko_gc_init (in /usr/lib/libneko.so)
==12881==
==12881== ERROR SUMMARY: 150 errors from 7 contexts (suppressed: 25 from 1)
==12881== malloc/free: in use at exit: 0 bytes in 0 blocks.
==12881== malloc/free: 0 allocs, 0 frees, 0 bytes allocated.
==12881== For counts of detected errors, rerun with: -v
==12881== All heap blocks were freed -- no leaks are possible.
Segmentation fault (core dumped)
[EMAIL PROTECTED]:~/haXe/Projects/hxPascal$
On Sun, 5 Aug 2007 20:03:22 -0400
blackdog <[EMAIL PROTECTED]> wrote:
>
> Hi Nicolas
>
> I'm trying to use freepascal for ndlls. So far I have a really simple
> test which works if I don't load the prim as a static, e.g. this works
>
> class Tests {
> //static var testint = neko.Lib.load("libnice","tester",1);
>
> static function main() {
> var testint = neko.Lib.load("libnice","tester",1);
> trace("blah");
> trace(testint(1));
> }
> }
>
> but this fails
>
> class Tests {
> static var testint = neko.Lib.load("libnice","tester",1);
>
> static function main() {
> // var testint = neko.Lib.load("libnice","tester",1);
> trace("blah");
> //trace(testint(1)); // <-- notice I'm not even
> calling this, it fails because of the load
> }
> }
>
> I don't want to bog you down with too much info, so can you think of
> any reason why a static might fail to load but the var to load? If you
> do want some more info then read on ;)
>
> I added some debug to load.c to see if the function is found or
> not and allocated as a neko prim or not, so for the failure I get this
>
> I've removed a number of calls for brevity
>
> .... removed some debug here ...
> got 0xb7cc9e40,allocated [EMAIL PROTECTED],ok
> got 0xb7cca7c0,allocated [EMAIL PROTECTED],ok
> got 0xb7cca680,allocated [EMAIL PROTECTED],ok
> got 0xb7cb3bf0,allocated [EMAIL PROTECTED],ok
> got 0xb7cb2d70,allocated [EMAIL PROTECTED],ok
>
> did get in here first:44
> code:B7C8B998
> got 0xb7c8b998,allocated [EMAIL PROTECTED],ok < --- Seems to be
> allocated
>
> got 0xb7cb09a0,allocated [EMAIL PROTECTED],ok
> got 0xb7cb0ae0,allocated [EMAIL PROTECTED],ok
> .... removed some debug here ...
> got 0xb7cb19f0,allocated [EMAIL PROTECTED],ok
> got 0xb7cb0670,allocated [EMAIL PROTECTED],ok
> Runtime error 207 at $B7CEA4C5
> $B7CEA4C5
> $080A8AAC
> $FFFFFFFF
>
> Error : Command failed
>
> The failure doesn't seem to be in the allocation of [EMAIL PROTECTED],
> but further on after all the other prims are loaded. Runtime
> error 207 is a pascal exception for an invalid float operation, so i
> have no idea why that is finally getting thrown, as my pascal doesn't
> use fp as far as I know - and in the fail I haven't even called
> tester.
>
> If you're interested the pascal looks like this, I've hard
> coded the DEFINE_PRIM right now
>
> library nice;
>
> uses neko;
>
> function tester(b:value):value ; cdecl;
> begin
>
> if val_is_int(b) then
> tester := alloc_string('nice')
> else
> tester := alloc_string('boo');
>
> end;
>
> function tester__1():Pointer; cdecl;
>
> begin
> writeln('did get in here
> first:',sizeof(Pointer),sizeof(@tester));
>
>
> tester__1 := @tester;
> Writeln('code:',hexstr(Longint(@tester),8));
> end;
>
> exports
> tester__1,tester;
>
> end.
>
> Thanks for any wisdom,
>
> bd
>
--
http://www.blackdog-haxe.com/
"It is no measure of health to be well adjusted to a profoundly sick
society." --Jiddu Krishnamurti
--
http://www.blackdog-haxe.com/
"It is no measure of health to be well adjusted to a profoundly sick
society." --Jiddu Krishnamurti
--
Neko : One VM to run them all
(http://nekovm.org)