Understanding the Synergy DLL API

The Synergy DLL API enables you to integrate DLLs into your application. A DLL (dynamic link library) is a library of executable functions or data that your Windows‑based application can call during execution.

On Windows, DLL files usually have one of the following extensions: .dll, .exe, .drv, or .fon. On UNIX, DLLs always have the extension .so.

You can either write your own DLL from scratch or acquire one of the many existing DLLs from an external source.

Important

DLLs created with Visual Basic are not accessible by Synergy. Synergy can only access DLLs written in a language that can create standard (non‑ActiveX) DLLs.

To integrate a DLL into your application,

1. Create or otherwise acquire a DLL. Refer to your operating system documentation for more information about creating a DLL.
2. If you’ve created a new DLL, explicitly export the routines that your Synergy program will call. How you export the routines depends on which tool you used to create it. Refer to the documentation for your development tool for instructions.
3. Write a routine that uses the Synergy %DLL_ functions to access the routines in the DLL. (Note that we recommend using the DllImport attribute instead of %DLL_NETCALL; see the %DLL_NETCALL Discussion for more information.)

Let’s say we want to add a splash screen to our application. Our routine might look like this:

record obj
    splash_dll    ,D_ADDR
    splash_form   ,i4

proc
    splash_dll = %dll_open("SYNBIN:synsw")              ;Open the splash DLL
  ; This DLL routine creates and displays the splash screen
    splash_form = %dll_call(obj.splash_dll,, "Create_SW")    
  ; Do whatever you want here while the splash screen is displayed
  ; This DLL routine removes and deletes the splash screen
    xcall dll_call(obj.splash_dll,, "Close_SW", splash_form) 
    xcall dll_close(splash_dll)                         ;Close the splash DLL
end