LIB: Difference between revisions

740 bytes added ,  24 April 2017
no edit summary
No edit summary
Line 7: Line 7:
* how an external library ("'''client'''") may be implemented that XDS can use
* how an external library ("'''client'''") may be implemented that XDS can use


The glue between host and client is based on http://cims.nyu.edu/~donev/Fortran/DLL/DLL.Forum.txt . There should be no need to change this, unless the interface design changes.
The glue code between host and client is based on http://cims.nyu.edu/~donev/Fortran/DLL/DLL.Forum.txt . There should be no need to change this, unless the interface design changes.


The interface was designed by Markus Methis (Dectris), Vittorio Boccone (Dectris) and Kay Diederichs. It is supposed to be generic, i.e. useful beyond XDS. In particular, the 4096 bytes of the info_array can be utilized to obtain and use header information (e.g. wavelength, distance, axes specifications and other metadata).   
The interface was designed by Markus Methis (Dectris), Vittorio Boccone (Dectris) and Kay Diederichs. It is supposed to be generic, i.e. useful beyond XDS. In particular, the 4096 bytes of the info_array can be utilized to obtain and use header information (e.g. wavelength, distance, axes specifications and other metadata).   


== host example ==
== Host code example ==
<pre>
<pre>
! example test program for existing external library
! example test program for existing external library
Line 114: Line 114:
</pre>
</pre>


== client example ==
== Client code example ==
<pre>
<pre>
! This reads single data files which have a header of 7680 bytes
! This reads single data files which have a header of 7680 bytes
Line 198: Line 198:
</pre>
</pre>


== glue code ==
== Glue code ==
The following code should be saved as generic_data_plugin.f90 .
The following code should be saved as generic_data_plugin.f90 .
<pre>
<pre>
Line 653: Line 653:
end module generic_data_plugin
end module generic_data_plugin
</pre>
</pre>
== Problems ==
Programs using dlclose (which is what the glue code does) may display
Program received signal SIGSEGV, Segmentation fault.
at termination. Using gdb, this reveals
<pre>
#0  0x00000000410c08b0 in ?? ()
#1  0x00000000406acbc2 in __nptl_deallocate_tsd () from /lib64/libpthread.so.0
#2  0x00000000406acdd3 in start_thread () from /lib64/libpthread.so.0
#3  0x00000000409b873d in clone () from /lib64/libc.so.6
</pre>
Google returns https://github.com/apple/cups/issues/4410 and https://bugzilla.redhat.com/show_bug.cgi?id=1065695 when searching for similar problems. Overall, this appears to be harmless and in fact I don't know how to change the code to make the segfault disappear  - I'd appreciate a patch!
2,684

edits