This document
describes how to interface with the
spinapi control
library, which is used to control all SpinCore products, including
PulseBlaster, PulseBlasterDDS, PulseBlasterESR, PulseBlasterESR-PRO,
and RadioProcessor..Windows CompilationThe spinapi control library is a standard windows .dll which can be accessed from a wide variety of programming environments, such as C/C++ programs, LabView, etc. Accessing spinapi from a C/C++ program This section describes the basic steps
needed to
get your C/C++
program to work with spinapi. Virtually
any C/C++ compiler/programming environment is compatible, feel free to
use
your favorite. If you do not currently have a C/C++ compiler,
there are
several high quality compilers available for free download on the
internet, see below for some recommendations. Four files are necessary to be able to
control your board using this approach. .c/.cpp
file: This is the
program itself. Several example C programs are included for each of our
different products. Import
library: This
library must be linked with your program so it will know to look inside
the spinapi.dll file to find the API functions. There are several
different file formats for import libraries, so we have provided three
different ones so that all compilers can be supported. Choose whichever
is appropriate for the compiler you are using. spinapi.lib:
Microsoft
compilers spinapi.dll:
The control
library itself. Windows must be able to find this file when you run
your program, so it needs to be placed in the same directory as the
executable program, or in one of the Windows directories (such as
C:\Windows\System32) The most straightforward way to compile a
program
using spinapi is
to create a new, empty directory and copy each of the four required
files listed above into it. Look in the dll/ directory to find
spinapi.h, spinapi.dll, and the import library. An example C program
can be found the the appropriate product subdirectory. Then open the C
file, configure your compiler to link with the import library, and
start the compile. It is recommended that you compile one of the
unchanged example programs first, to ensure your compiler is set up
correctly. Once the example is compiled correctly, you can move on to
creating custom programs. Below are detailed instructions for
specific
compilers on how to
configure them to use spinapi. The procedure for other compilers should
be similar. These instructions assume you have copied the four required
files into their own directory as described above. Microsoft Visual Studio 6: 1) Open the C file
2) Select "Build | Compile zzz.c" from the menu. (zzz.c will be the name of the C file you opened) 3) You will be asked if you wish to create a new workspace. Answer yes. 4) You must tell the compiler to use the import library. Choose "Product | Settings..." from the menu. Click on the "Link" tab. In the "Object/Library modules:" box, add spinapi.lib in addition to the libraries already listed, and click "Ok" 5) Everything is now configured correctly. To build the executable, simply choose "Build | Build zzz.exe" from the menu, and the program will be created and placed in the Debug subdirectory. Dev-C++: 1) Open the C file Free C/C++ Compilers:
Virtually all programming environments
provide
some mechanism for
accessing an API provided by a Windows .dll. Please consult the help
files of your environment if you are unsure of how to do this.
Linux Compilation
|