axiom-developer
[Top][All Lists]
Advanced

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

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


From: Gernot Hueber
Subject: RE: [Axiom-developer] Call Foreign C from Aldor/Axiom
Date: Thu, 01 Jun 2006 08:58:52 +0200

On Wed, 2006-05-31 at 11:01 -0400, Page, Bill wrote:
> On Wednesday, May 31, 2006 2:54 AM Gernot Hueber wrote:
> 
> > 
> > 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.
> >
> 
> Great! I am very happy you are looking into this.
>  
> > ... 
> > Now, my questions:
> > .) s 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)?
> > 
> 
> See:
> 
> http://wiki.axiom-developer.org/SandBoxAldorForeign
> 
> The first section containing
> 
>   (defentry |myprintf| (string) (int "printf"))
> 
> is compiled as a lisp function but notice that it becomes
> part of the BOOT package.

Well, I don't get this point, but I have to admit, I have no
understanding of the BOOT package.

> 
> Now we can compile some Aldor code that calls this function
> and then call the Aldor function from Axiom.
> 
> For loading an external library did you try the usual Axiom
> command
> 
>  )library nputs.o
> 
> Or via lisp like this:
> 
>  )lisp (load nputs.o)
> 
> ?

Sorry, no success: )lib nputs.o gives me ")library cannot find the file
nputs.", )lisp (load nputs.o) returns "<< System error: The variable
NPUTS is unbound".

I am thinking of importing defentry into Aldor to define the C command
to Lisp. Something like
-------------
import {defentry: (??) -> ?} from Foreign Lisp;

-- call imported defentry to declare C command to underlying Lisp
defentry("printf","string","int");
-------------
Obviously the give syntax wont work. But you could move the Lisp
defentry into Aldor.



> 
> Can you send me the example code for 'nputs.c'?

See for the full example: http://www.aldor.org/docs/HTML/chap19.html
----
/*
 * nputs.c: A simple C function.
 */
void
nputs(int n, char *s)
{
        int     i;
        for (i = 0; i < n; i++) puts(s);
}
-----

Regards

Gernot

> Regards,
> Bill Page.
> 
> 
-- 
DI Gernot Hueber
Institut für Integrierte Schaltungen
Altenbergerstr. 69
4040 Linz
Tel +43 732 2468 7120
Fax +43 732 2468 7126
Email address@hidden
Web   www.riic.at





reply via email to

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