| 1 | pro build_testmodule, VERBOSE=verbose |
|---|
| 2 | |
|---|
| 3 | ; Locate the testmodule files from the IDL distribution |
|---|
| 4 | ; |
|---|
| 5 | subdirs = [ 'external', 'dlm' ] |
|---|
| 6 | testmodule_dir = FILEPATH('', SUBDIRECTORY=subdirs) |
|---|
| 7 | dlm_file = FILEPATH('testmodule.dlm_base', SUBDIRECTORY=subdirs) |
|---|
| 8 | new_dlm_file = $ |
|---|
| 9 | FILEPATH('testmodule.dlm', ROOT_DIR=!make_dll.compile_directory) |
|---|
| 10 | |
|---|
| 11 | ; Build the testmodule DLM in the !MAKE_DLL.COMPILE_DIRECTORY directory. |
|---|
| 12 | ; |
|---|
| 13 | ; Normally, you wouldn't use VERBOSE, or SHOW_ALL_OUTPUT once your |
|---|
| 14 | ; work is debugged, but as a learning exercise it can be useful to |
|---|
| 15 | ; see all the underlying work that gets done. If the user specified |
|---|
| 16 | ; VERBOSE, then use those keywords to show what MAKE_DLL is doing. |
|---|
| 17 | ; |
|---|
| 18 | ;MAKE_DLL, 'testmodule','IDL_Load', INPUT_DIR=testmodule_dir, $ |
|---|
| 19 | ; VERBOSE=verbose, SHOW_ALL_OUTPUT=verbose |
|---|
| 20 | |
|---|
| 21 | inputfiles = [ 'NeXusIDL-API','handle'] |
|---|
| 22 | inputdir = '/home/scratch/lns/kauppila/temp/IDLNeXus-API' |
|---|
| 23 | |
|---|
| 24 | cd,'.',current=dir |
|---|
| 25 | |
|---|
| 26 | MAKE_DLL, inputfiles, 'IDL_Load', compile_directory=dir, INPUT_DIRECTORY=dir, output_dir=dir, EXTRA_CFLAGS='../../src/trunk/src/.libs/libNeXus.a -L$(HDFROOT)/lib -lhdf5 -lmfhdf -ldf -lmxml -lsz -lz -lm -ljpeg -lm ' |
|---|
| 27 | |
|---|
| 28 | ; Copy the DLM file into the directory with the sharable library |
|---|
| 29 | FILE_COPY, dlm_file, new_dlm_file, /OVERWRITE |
|---|
| 30 | |
|---|
| 31 | |
|---|
| 32 | ; NOTE TO IDL USERS: This call to DLM_REGISTER is not the recommended |
|---|
| 33 | ; way to make DLMs known to your IDL session. The best, and usually |
|---|
| 34 | ; the only recommended, way to do this is to put the DLM files into |
|---|
| 35 | ; one of the directories searched by IDL at startup (and contained in |
|---|
| 36 | ; the !DLM_PATH system variable). Not only is is easier, but IDL will |
|---|
| 37 | ; know the routines from your DLM before it compiles a single line of |
|---|
| 38 | ; PRO code, avoiding one of the most common LINKIMAGE pitfalls. |
|---|
| 39 | ; DLMs are largely intended to provide a safer easier interface to |
|---|
| 40 | ; the capabilities of LINKIMAGE, so this is an important point. |
|---|
| 41 | ; |
|---|
| 42 | ; We do this here in order to simplify the demo. Otherwise, it would be |
|---|
| 43 | ; necessary to alter the !DLM_PATH, and restart IDL, none of which is |
|---|
| 44 | ; really central to our demo. |
|---|
| 45 | ; |
|---|
| 46 | ;DLM_REGISTER, new_dlm_file |
|---|
| 47 | |
|---|
| 48 | ; Display the DLM so the user can see that it is there |
|---|
| 49 | ; |
|---|
| 50 | ;print,'' |
|---|
| 51 | ;HELP,/DLM, 'testmodule' |
|---|
| 52 | |
|---|
| 53 | ; Run the 2 routines. Note that I have to use EXECUTE so that IDL |
|---|
| 54 | ; will see these as system routines within this BUILD_TESTMODULE |
|---|
| 55 | ; routine. This is because BUILD_TESTMODULE was compiled by IDL |
|---|
| 56 | ; before it knew about the TESTMODULE DLM, and as such, plain calls |
|---|
| 57 | ; get turned into IDL user routine calls. Since EXECUTE compiles at |
|---|
| 58 | ; runtime, it will see them as system routines now that DLM_REGISTER |
|---|
| 59 | ; has been called. |
|---|
| 60 | ; |
|---|
| 61 | ; This is the LINKIMAGE pitfall mentioned above, and a very good |
|---|
| 62 | ; reason not to make a habit of using DLM_REGISTER. |
|---|
| 63 | ; |
|---|
| 64 | ;void = execute('testpro') |
|---|
| 65 | ;void = execute('print, testfun()') |
|---|
| 66 | |
|---|
| 67 | end |
|---|