(import) and (load)

For the Compleat Fan
Locked
alex
Posts: 100
Joined: Thu Mar 10, 2005 2:27 pm
Location: Russia

(import) and (load)

Post by alex »

Why such difference?
We can "import" only one function, but we can "load" library.
Why we can't "import/load" full library?

newdep
Posts: 2038
Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands

Post by newdep »

Hi Alex,

Do you mean you want just to load the Library and isolate atomaticly the
defined functions from it?

Regards, Norman
-- (define? (Cornflakes))

alex
Posts: 100
Joined: Thu Mar 10, 2005 2:27 pm
Location: Russia

Post by alex »

I am sorry for my bad English
I can't understand now why I can't (import) full library.
Why I must think about inner functions?

newdep
Posts: 2038
Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands

Post by newdep »

An import is a specific C call to open a library, because you dont know
in advance what the "defines"/"functions" are in the library you cant
do it directly with an import.

A "load" is specific for newlisp code..

Norman.
-- (define? (Cornflakes))

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

Libraries typically contain a larger amount of functions for a specific area, much more than you would typically need in a specific application. Typically you import a a few functions but the library may contain hundreds.

Its like you city library, you just want to check out a few books but don't take the whole library home.

Lutz

alex
Posts: 100
Joined: Thu Mar 10, 2005 2:27 pm
Location: Russia

Post by alex »

I understand all :)
And I have now theoretical(probably) question:
when I (import) function, I load full library to memory, or not?

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

Only one instance of the library gets loaded on the OS, thats why they call it shared library. So even if you do several import statements you will load the library only once, or not at all, if another process on your machine has already loaded it.

Lutz

Locked