updating oE open_dll



include dll.e 
namespace dll 
public function open_dll(sequence file_name) 

opens a Windows dynamic link library (.dll) file, or a Unix shared library (.so) file.

  1. file_name : a sequence, the name of the shared library to open or a sequence of filename's to try to open.

An atom, actually a 32-bit address. 0 is returned if the .dll can not be found.


The length of file_name (or any filename contained therein) should not exceed 1_024 characters.


file_name can be a relative or an absolute file name. Most operating systems will use the normal search path for locating non-relative files.

file_name can be a list of file names to try. On different Linux platforms especially, the filename will not always be the same. For instance, you may wish to try opening libmylib.so, libmylib.so.1, libmylib.so.1.0, libmylib.so.1.0.0. If given a sequence of file names to try, the first successful library loaded will be returned. If no library could be loaded then zero will be returned after exhausting the entire list of file names.

The value returned by open_dll can be passed to define_c_proc, define_c_func, or define_c_var.

You can open the same .dll or .so file multiple times. No extra memory is used and you will get the same number returned each time.

Euphoria will close the .dll or .so for you automatically at the end of execution.

Example 1:
atom user32 
user32 = open_dll("user32.dll") 
if user32 = 0 then 
   puts(1, "Couldn't open user32.dll!\n") 
end if 
Example 2:
atom mysql_lib 
mysql_lib = open_dll({"libmysqlclient.so", "libmysqlclient.so.15",  
if mysql_lib = 0 then 
  puts(1, "Couldn't find the mysql client library\n") 
end if 
See Also:

define_c_func, define_c_proc, define_c_var, c_func, c_proc

Not Categorized, Please Help


Quick Links

User menu

Not signed in.

Misc Menu