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

-- 
Neko : One VM to run them all
(http://nekovm.org)

Reply via email to