Reason for lack of Oracle driver

Tim Rowledge tim at sumeru.stanford.edu
Tue Jul 1 23:29:03 UTC 2003


Martin Drautzburg <martin.drautzburg at web.de> wrote:

> I must admit I know very little about these things.
> 
> A plugin is a shared library that is accessible from squeak, right ?
Yes, in the most general sense of 'shared library'. Squeak doesn't
'know' that plugins are any particular form of library, nor whether they
are dynamically loaded or prelinked. VM Plugins are not shared between
multiple running VMs unless it just so happens that that OS can do that
for itself. For each platform there is some (usually) simple code that
can search for and load a plugin if it is external or search the
function tables if it is internal. See files like
platforms.win32.vm.sqWin32ExternalPrims.c etc for details.

> So are you suggesting to put an extra shlib layer between squeak and
> the oracle shared lib. Why shoulnd't I talk directly to the oracle lib
Using a VM plugin will in fact be much more direct than using the FFI
code and (probably) much faster. To use the FFI stuff involves
specifying the interface in such a way that the ffi prims can unpack,
detag, twist and turn and cook to perfection all the objects that you
pass in - and similarly for all the returned values and pointed to data.
This enables a lot of flexibility at the cost of time and trouble. If
you know what interfaces you need and can be bothered to write the Slang
code for a plugin it will almost always be faster since you can very
specifically handle the parameters.

You can also merge calls to a couple of apis if that makes for a cleaner design;
imagine needing an api to load the entire contents of a known binary file.
Instead of
<open file>
<read size> of file
sizeOfFile timesRepeat:[<read byte into array>]
<close file>
you could find it better to do
<read contents of file>

Probably a bad example but the best I can think of right now.


> 
> How about portablility. Assuming the oracle libs have the same
> interface on Linux and Windows, they still have different names. Can
> the <angle bracket ffi code> contain a Module whose name is a variable
This is another nice bit of abstractinga plugin can provide. Your
FoobleDatabasePlugin prims will be accessed as
<primitive: 'wibble' module: 'FoobleDatabasePlugin>
on all platforms >even if each platform needs a quite different plugin<


tim
--
Tim Rowledge, tim at sumeru.stanford.edu, http://sumeru.stanford.edu/tim
If you want to save the forests, chop down the Bush



More information about the Squeak-dev mailing list