4

Is it possible to build shared libraries (e.g. *.so, *.dll) using languages other than C or C++?

What is the underlying requirement to build a shared library? Is it that the language be capable of compiling to a native binary?

I'm particularly interested to find out if it is possible to build a shared library from Prolog.

E.g. could I build a .so using Prolog, which I could then link to from another language, C, Java, Python etc.

daven11
  • 2,905
  • 3
  • 26
  • 43
bph
  • 10,728
  • 15
  • 60
  • 135

1 Answers1

1

You can build a shared library with a number of languages. One I use regularly is Delphi, which can create dll's for windows.

For Prolog, not sure if you can create a shared library, it would need some sort of run time environment, if any did I'd start with GNU-Prolog. The problem isn't technical so much as licensing.

There are prologs around that can be used as a shared library, and linked in with your app, written in anything that can include a shared library (most languages). A quick google turned up these http://www.swi-prolog.org/FAQ/, http://www.gprolog.org/#platform

daven11
  • 2,905
  • 3
  • 26
  • 43
  • can you call your delphi shared library direct from C/C++? – bph Oct 03 '12 at 10:37
  • sure depending on which C/C++ you use. http://www.esanu.name/delphi/DLL/Calling%20delphi%20DLL%20from%20MS%20Visual%20C.html or http://stackoverflow.com/questions/6017787/using-a-delphi-dll-in-c. With non embarcadero C++, you'd typically have to write a little wrapper that's C compatible - same for any object language called from C. Or you can use COM – daven11 Oct 04 '12 at 08:28