Building a dynamic library with C routines

Before you build a DLL or shared object that contains your C routines, you must first initialize the runtime C interface using the optional second argument to the %DLL_OPEN routine. Follow the instructions below:

1. (Windows only) Add the following export command to the EXPORTS section of the .def file that you use to build your DLL:
xclapi_setup_ptr
2. Link the file xclapi.obj (or xclapi.o on Unix) into your shared object. If you are using the floating point routines (get_xarg_fval and put_xarg_fval), you must also link in xclapif.obj (or xclapif.o on Unix).
3. Add a new DLL handle to your common global area. For example:
dllhand, D_ADDR
4. Modify your programs to open your DLL by calling %DLL_OPEN, making sure to specify the optional C interface flag as the second argument. For example:
dllhand = %DLL_OPEN(mydll, 1)
5. Either modify your programs to use %DLL_CALL instead of XCALL, or use a .DEFINE macro. (See Parameterized macros for more information about .DEFINE macros.)

For example, if your code contained

xcall ttqis(row, col, "text")

and ttqis was a routine you linked into the Synergy runtime, you could add the following to your standard include files:

.define ttqis(a,b,c) dll_call(dllhand, DLL_TYPE_DBLCALL, "ttqis", a,b,c)

If you have a variable number of arguments, always specify the highest number of arguments in the .DEFINE statement. The maximum number of arguments is 20.