First off "NewLisp" is so awesome, really liking it.
BTW: I am running it on Red Hat Linux 64 bit machine.
Also, I understand NewLisp deals with integers and floats.....but just curious about "doubles"
Quick question that I hope someone can help me with. So below is a very basic "shared lib":
dummy.h
Code: Select all
double doCalc(double x);
dummy.c
Code: Select all
#include <stdio.h>
#include <stdlib.h>
double doCalc(double x){
double y;
printf("Number passed in: %f\n", x);
y = x * 2;
printf("Number multiplied by 2 is: %f\n", y);
return y;
}
Code: Select all
CC = gcc
all: libdummy.so
libdummy.so:
$(CC) -m64 -Wall -g -I./ -c -fPIC ./dummy.c -o ./dummy.o
$(CC) -m64 -shared -o ./libdummy.so ./dummy.o -L/usr/lib64
clean:
rm ./*.so
newLISP v.10.6.0 64-bit on Linux IPv4/6 UTF-8 libffi, options: newlisp -h
> (import "/home/lynton/Desktop/ffi/libdummy.so" "doCalc")
doCalc@7F5D59D2C57C
> (doCalc 8.7)
Number passed in: 8.700000
Number multiplied by 2 is: 17.400000
4625590882276894310
>
Why would the above return 4625590882276894310 to NewLisp when it should have been "17.4"?
Am I doing something stupid here?
Thanks for the help
Lynton