FLI Problems with LispWorks 
Author Message
 FLI Problems with LispWorks

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



Sun, 23 Nov 2003 20:13:11 GMT  
 FLI Problems with LispWorks

Quote:

> 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



Sun, 23 Nov 2003 22:43:58 GMT  
 FLI Problems with LispWorks

Quote:

> 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



Mon, 24 Nov 2003 00:09:28 GMT  
 FLI Problems with LispWorks

Quote:

> 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



Mon, 24 Nov 2003 00:18:16 GMT  
 FLI Problems with LispWorks

Quote:

> 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



Mon, 24 Nov 2003 04:29:46 GMT  
 FLI Problems with LispWorks
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


Quote:

> > 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



Mon, 24 Nov 2003 05:07:02 GMT  
 FLI Problems with LispWorks
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



Mon, 24 Nov 2003 06:13:08 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. Wrong phentsize in LispWorks FLI

2. Lispworks FLI

3. Lispworks: CORBA+FLI=SEGV?

4. Lispworks: passing strings in FLI

5. LispWorks FLI question

6. MODELSIM FLI PROBLEM

7. Problems with Modelsim′s FLI

8. AServe + LispWorks bivalent-socket Problem solved

9. Is there a LispWorks FLI file available for native Win32 api ?

10. Playing FLI

11. fli to mpeg conversion

12. PLI,FLI,FMI abstraction layer

 

 
Powered by phpBB® Forum Software