From: Malauss�ne
Subject: The package
Date: 
Message-ID: <aamn3v$lln$1@wanadoo.fr>
Hi,

I try to use the fonction (define in the file called file1.lisp) in the
other file which own to a package.
In a simplified manner :

file1.lisp
---------------
(defun f (x) ....)
---------------

file2.lisp (file which is owned by a CLIM program)
--------------
(in-package :LEMIEN)

(defun g(x)
  (f 4))
-------------

I tried to call the file with the code (load "file1.x86f"), but it didn't
run and Common Lisp returns the error : function f undefined.
Have you got a solution to my problem ??

--
 Malauss�ne
"Sorry to my many question"

From: Nils Goesche
Subject: Re: The package
Date: 
Message-ID: <87g01dkp72.fsf@darkstar.cartan>
"Malauss�ne" <·······@wanadoo.fr> writes:

> I try to use the fonction (define in the file called file1.lisp) in the
> other file which own to a package.
> In a simplified manner :
> 
> file1.lisp
> ---------------
> (defun f (x) ....)
> ---------------
> 
> file2.lisp (file which is owned by a CLIM program)
> --------------
> (in-package :LEMIEN)
> 
> (defun g(x)
>   (f 4))
> -------------
> 
> I tried to call the file with the code (load "file1.x86f"), but it didn't
> run and Common Lisp returns the error : function f undefined.
> Have you got a solution to my problem ??

You didn't provide enough information (e.g.: how is the package
"LEMIEN" defined?).  Here is one simple example (untested):

(defpackage "FOO"
  (:use "COMMON-LISP")
  (:export "F"))

(in-package "FOO")

(defun f (x)
  (+ x 42))

;; Now let's someone call F from another package

(defpackage "BAR"
  (:use "COMMON-LISP"))

(in-package "BAR")

(defun g (x)
  (foo:f x))   ; if f wasn't exported, you could still call it as foo::f

;; Here is another way

(defpackage "BLARK"
  (:use "COMMON-LISP" "FOO"))

(in-package "BLARK")

(defun h (x)
  (f (- x)))

Regards,
-- 
Nils Goesche
Ask not for whom the <CONTROL-G> tolls.

PGP key ID #xC66D6E6F
From: Malauss�ne
Subject: Re: The package
Date: 
Message-ID: <aamqp4$67j$1@wanadoo.fr>
"Nils Goesche" <···@cartan.de> a �crit dans le message de news:
··············@darkstar.cartan...
> "Malauss�ne" <·······@wanadoo.fr> writes:
> > I try to use the fonction (define in the file called file1.lisp) in the
> > other file which own to a package.
> You didn't provide enough information (e.g.: how is the package
> "LEMIEN" defined?).  Here is one simple example (untested):
>
> (defpackage "FOO"
>   (:use "COMMON-LISP")
>   (:export "F"))
> (in-package "FOO")
> (defun f (x)
>   (+ x 42))

Ok, you have answer me to my question.
I have another question.
I didn't have one file (with the f function) but six files.
It mean that :
file00.lisp------
(load "file01.x86f")
...
___________

file01.lisp------
(load "file03.x86f")
(load "file04.x86f")
...
____________
etc.

What do i do for transform this group of file to a package ??
I think in the principal file, I do like you show me : (defpackage "FOO")
and in others ???

--
 Malauss�ne
From: Nils Goesche
Subject: Re: The package
Date: 
Message-ID: <87bsc0lug8.fsf@darkstar.cartan>
"Malauss�ne" <·······@wanadoo.fr> writes:

> "Nils Goesche" <···@cartan.de> a �crit dans le message de news:
> ··············@darkstar.cartan...
> > "Malauss�ne" <·······@wanadoo.fr> writes:
> > > I try to use the fonction (define in the file called file1.lisp) in the
> > > other file which own to a package.
> > You didn't provide enough information (e.g.: how is the package
> > "LEMIEN" defined?).  Here is one simple example (untested):
> >
> > (defpackage "FOO"
> >   (:use "COMMON-LISP")
> >   (:export "F"))
> > (in-package "FOO")
> > (defun f (x)
> >   (+ x 42))
> 
> Ok, you have answer me to my question.
> I have another question.
> I didn't have one file (with the f function) but six files.
> It mean that :
> file00.lisp------
> (load "file01.x86f")
> ...
> ___________
> 
> file01.lisp------
> (load "file03.x86f")
> (load "file04.x86f")
> ...
> ____________
> etc.
> 
> What do i do for transform this group of file to a package ??
> I think in the principal file, I do like you show me : (defpackage "FOO")
> and in others ???

I am not sure I understand the question.  If you want all the
symbols in all the files to be put into the same package, the
easiest way would be to put a line (in-package "FOO") on top of
each.  Then, you'd have to make sure that you load the file
containing the DEFPACKAGE form first.

Regards,
-- 
Nils Goesche
Ask not for whom the <CONTROL-G> tolls.

PGP key ID #xC66D6E6F