From: Jochen Schmidt
Subject: FLI Problems with LispWorks
Date: 
Message-ID: <9fl6dl$4r6on$1@ID-22205.news.dfncis.de>
After taking a look in Chris Doubles SSL-Socket implementation I started
some experiments with LispWorks (4.1.20, Enterprise Edition, Linux)

I defined the following foreign-function

(fli:define-foreign-function (ssl-library-init "SSL_library_init" :source)
  ()
  :result-type :int
  ::language :ansi-c)

Which has following declaration in /usr/include/ssl/ssl.h

int SSL_library_init(void ); 

I've registered the SSL library as following:

(fli:register-module "libssl.so")

But if I try to call (ssl-library-init) I get the error:

  Error: Foreign function SSL-LIBRARY-INIT trying to call to unresolved  
  external function "SSL_library_init".

I tried changing the library-name:

(fli:register-module "/usr/lib/libssl.so")

But this changed nothing.

I know this from my Problems of getting the libGLU under OpenGL running on 
LispWorks for Linux - so I tried the approach that helped there and created 
a shared object file:

$ ld -shared -o ssl.so -L/usr/lib -lssl

And then I registered that:

(fli:register-module "/home/jsc/lisp/src/ssl/ssl.so")

But nothing changed.

Is there anyone other having the same problems?
Is there something I missed doing?

Regards,
Jochen

From: Geoff Summerhayes
Subject: Re: FLI Problems with LispWorks
Date: 
Message-ID: <thsg1lps61eee1@corp.supernews.com>
"Jochen Schmidt" <···@dataheaven.de> wrote in message ···················@ID-22205.news.dfncis.de...
> After taking a look in Chris Doubles SSL-Socket implementation I started
> some experiments with LispWorks (4.1.20, Enterprise Edition, Linux)
>
> I defined the following foreign-function
>
> (fli:define-foreign-function (ssl-library-init "SSL_library_init" :source)
>   ()
>   :result-type :int
>   ::language :ansi-c)
>
> Which has following declaration in /usr/include/ssl/ssl.h
>
> int SSL_library_init(void );
>
> I've registered the SSL library as following:
>
> (fli:register-module "libssl.so")
>
> But if I try to call (ssl-library-init) I get the error:
>
>   Error: Foreign function SSL-LIBRARY-INIT trying to call to unresolved
>   external function "SSL_library_init".
>
> I tried changing the library-name:
>
> (fli:register-module "/usr/lib/libssl.so")
>
> But this changed nothing.
>
> I know this from my Problems of getting the libGLU under OpenGL running on
> LispWorks for Linux - so I tried the approach that helped there and created
> a shared object file:
>
> $ ld -shared -o ssl.so -L/usr/lib -lssl
>
> And then I registered that:
>
> (fli:register-module "/home/jsc/lisp/src/ssl/ssl.so")
>
> But nothing changed.
>
> Is there anyone other having the same problems?
> Is there something I missed doing?
>
> Regards,
> Jochen

Just a guess from the FLI manual. Section 1.1.2 Loading foreign code
Do you have a call to link-load:read-foreign-modules?

Geoff
From: Jochen Schmidt
Subject: Re: FLI Problems with LispWorks
Date: 
Message-ID: <9flk8k$4n4po$1@ID-22205.news.dfncis.de>
Geoff Summerhayes wrote:

> 
> Just a guess from the FLI manual. Section 1.1.2 Loading foreign code
> Do you have a call to link-load:read-foreign-modules?

No - The Linux port uses the same API like the Windows version of LispWorks.
You use FLI:REGISTER-MODULE to load a Library.

Regards,
Jochen
Jochen
From: Friedrich Dominicus
Subject: Re: FLI Problems with LispWorks
Date: 
Message-ID: <87iti9shtj.fsf@frown.here>
"Geoff Summerhayes" <·············@hNoOtSmPaAiMl.com> writes:


> 
> Just a guess from the FLI manual. Section 1.1.2 Loading foreign code
> Do you have a call to link-load:read-foreign-modules?

No I don't think that will is the case. The Release Notes say:
"Chapter 11, 'The LINK-LOAD Package" should be disregarded: the link
loader only suports shared libraries  and the replacement for
link-load:read-foreign-modules is fli:register-module as documented in
... (Link is outdated and won't help)

So I think the best Jochen can do is asking the Xanalys support...

Regards
Friedrich
From: Jochen Schmidt
Subject: Re: FLI Problems with LispWorks (solved)
Date: 
Message-ID: <9fm9ig$4nrle$1@ID-22205.news.dfncis.de>
I've found my error.

I've never tried to call SSL_library_init in a C program.
If I had done so I would have realized that I need not only to link in
the libssl.so but also libcrypto.so!

Adding libcrypto.so to the registered modules in Lisp doesn't change 
anything.

But the trick I used in OpenGL vs. libGLU has done it:

create a shared object file like this:

ld -shared -o ssl.so -L/usr/lib -lssl -lcrypto

And then in Lisp you register this shared object file:

(fli:register-module "/home/jsc/src/ssl/ssl.so")

After that - it works.

Conclusion (or what I've learned):
1) It is a _really_ good idea to simply try it in C first!
2) If there are "Inter-library dependencies" then create a shared object
    file.

Regards,
Jochen Schmidt
From: Chris Double
Subject: Re: FLI Problems with LispWorks
Date: 
Message-ID: <wkiti9l5c5.fsf@double.co.nz>
Jochen Schmidt <···@dataheaven.de> writes:

> But if I try to call (ssl-library-init) I get the error:
> 
>   Error: Foreign function SSL-LIBRARY-INIT trying to call to unresolved  
>   external function "SSL_library_init".

Just a wild guess...

Do the 'C' names have to start with an underscore? What if you had the
'C' name as '_SSL_library_init'?

Chris.
-- 
http://www.double.co.nz/cl
From: Wade Humeniuk
Subject: Re: FLI Problems with LispWorks
Date: 
Message-ID: <9fm60g$3rl$1@news3.cadvision.com>
That is possible.  You could do a nm (I think) on the shared library and see
what the external symbols are.

Also, Jochen, did you just install OpenSSL on Linux?  Excuse me for being
pendantic but

Make sure libssl.so in a path that is in /etc/ld.so.conf.
Run ldconfig as su.

Wade


"Chris Double" <·····@double.co.nz> wrote in message
···················@double.co.nz...
> Jochen Schmidt <···@dataheaven.de> writes:
>
> > But if I try to call (ssl-library-init) I get the error:
> >
> >   Error: Foreign function SSL-LIBRARY-INIT trying to call to unresolved
> >   external function "SSL_library_init".
>
> Just a wild guess...
>
> Do the 'C' names have to start with an underscore? What if you had the
> 'C' name as '_SSL_library_init'?
>
> Chris.
> --
> http://www.double.co.nz/cl