axiom-developer
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Axiom-developer] Call Foreign C from Aldor/Axiom


From: Gernot Hueber
Subject: [Axiom-developer] Call Foreign C from Aldor/Axiom
Date: Wed, 31 May 2006 08:54:24 +0200

Hello,

Due to that I want to call external library functions from within
Aldor/Axiom I did some trials with Aldors "Foreign" and GCL "defentry"
commands.

First of all, an example that work (partly), adapted from the aldor
users guide:

----
#include "axiom.as"

SI ==> SingleInteger;

arigato():PositiveInteger == {
import { printf: (String) -> SI } from Foreign C;
import from SI;
printf("Arigato gozaimasu!");
1;
}
----

This one compiles fine, yet it does not run. Thus I added
--
(defentry |printf| (string) (int "printf"))
--
to the arigato.lsp and recompiled the lisp code. Now the function
returns
--
(4) -> arigato()
Arigato gozaimasu!
   (4)  1
                                                        Type:
PositiveInteger
--

:-)

Second example is more similar to the arigato-example from the Aldor
users guide:
--
#include "axiom.as"

SI ==> SingleInteger;

arigato2():PositiveInteger == {
import { nputs: (SI, String) -> SI } from Foreign C;
import from SI;
nputs(3,"Arigato gozaimasu!");
1;
}
--
If I run this one (with the defentry trick), I get:
--
(4) -> arigato2()
symbol "nputs" is not in base image
   >> System error:
   Caught fatal error [memory may be damaged]
--
Obviously due to that the nputs.o is not loaded (which I have in the
local directory).

Now, my questions:
.) Is there a recommended/better way to call external functions within
Aldor/Axiom?
.) I think, the "defentry" part  could be added with an Aldor "Foreign
Lisp" call?
.) How can I "load", external libraries (e.g. nputs.o)?

Thanks

Gernot

-- 
Dipl.-Ing. Gernot Hueber

Johannes-Kepler Universität
Institut für Integrierte Schaltungen
Altenbergerstr. 69
A-4040 Linz
Email: address@hidden
Tel: +43 732 2468 7120
Fax: +43 732 2468 7126





reply via email to

[Prev in Thread] Current Thread [Next in Thread]