Contents Previous Next Subchapters

Linking A Compiled Function
Syntax dll file namef1f2...fn
See Also: mycolmax , myrowmax , dllall

Description
Links the functions f1, through fn, to the current O-Matrix session. Compiled versions of these functions must be present in the DLL library specified by file name .

Example
The file dll\sample.dll contains a function called mycolmax that has the same specifications as the routine colmax . If at the command line you enter
     dll dll\sample.dll, mycolmax
     x = [{1, 5, 3}, {3, 2, 1}]
     mycolmax(x)
O-Matrix will respond
     [ 5 , 3 ]
because five is the maximum element in the first column of x and three is the maximum element in the second column.

Reference
It is possible to use the save command to save a compiled version of a program on one system and then use the lightexe command to execute the program on another system. If there are dll commands in the saved program, the file name will correspond to the path for the system that the program is compiled on. It is possible, using the eval command, to delay binding the path to the file until the program is executed. Here is an example that does this:
     clear
     function example() begin
          x = [{1, 5, 3}, {3, 2, 1}]
          eval("dll dll\sample.dll, mycolmax")
          eval("mycolmax(x)")
     end
     save example.omx
If you execute this program on one system and then copy the file example.omx to another system and execute the command
     lightexe("example.omx", example)
the path for the file dll\sample.dll will correspond to the system where the lightexe command is executed.