File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ function lsl_fname = lsl_get_dll(binarypath , debugging )
2+ % Search for the lsl library
3+ % [lsl_fname] = lsl_get_dll(binarypath, debugging)
4+ %
5+ % In:
6+ % BinaryPath : Optionally the path to the locations of the liblsl bin folder (default: relative
7+ % to this .m file).
8+ %
9+ % DebugVersion : Optionally load the debug version of the library (default: false)
10+ %
11+ % Out:
12+ % lsl_fname : the filename of the library
13+
14+ if ~exist(' binarypath' ,' var' ) || isempty(binarypath )
15+ binarypath = [fileparts(mfilename(' fullpath' )) filesep ' bin' ];
16+ end
17+ if ~exist(' debugging' ,' var' ) || isempty(debugging )
18+ debugging = false ;
19+ end
20+
21+ if ispc
22+ ext = ' .dll' ;
23+ elseif ismac
24+ ext = ' .dylib' ;
25+ elseif isunix
26+ ext = ' .so' ;
27+ else
28+ error(' Your operating system is not supported by this version of the lab streaming layer API.' );
29+ end
30+
31+ if strfind(computer ,' 64' )
32+ bitness = ' 64' ;
33+ else
34+ bitness = ' 32' ;
35+ end
36+
37+ if debugging
38+ debug = ' -debug' ;
39+ else
40+ debug = ' ' ;
41+ end
42+
43+ dll_fname = sprintf(' liblsl%s%s%s ' , bitness , debug , ext );
44+ lsl_fname = fullfile(binarypath , dll_fname );
45+
46+ if ~exist(lsl_fname , ' file' ) && ~ispc
47+ new_dllpath = fullfile(' /usr/lib/' , dll_fname );
48+ if exist(new_dllpath , ' file' )
49+ lsl_fname = new_dllpath ;
50+ end % if
51+ end % if
52+
53+ if ~exist(lsl_fname ,' file' )
54+ error([' Apparently the file "' dllpath ' " is missing on your computer. Cannot load the lab streaming layer.' ]);
55+ end
56+
57+ end
58+
Original file line number Diff line number Diff line change 2424% 2012-03-05
2525
2626if ~exist(' binarypath' ,' var' ) || isempty(binarypath )
27- binarypath = [fileparts(mfilename(' fullpath' )) filesep ' bin' ]; end
27+ binarypath = [];
28+ end
2829if ~exist(' debugging' ,' var' ) || isempty(debugging )
29- debugging = false ; end
30+ debugging = false ;
31+ end
3032if ~exist(' keep_persistent' ,' var' ) || isempty(keep_persistent )
31- keep_persistent = true ; end
33+ keep_persistent = true ;
34+ end
3235
3336persistent lib ;
3437if keep_persistent && ~isempty(lib )
3538 hlib = lib ;
3639else
37- if ispc
38- ext = ' .dll' ;
39- elseif ismac
40- ext = ' .dylib' ;
41- elseif isunix
42- ext = ' .so' ;
43- else
44- error(' Your operating system is not supported by this version of the lab streaming layer API.' );
45- end
46-
47- if strfind(computer ,' 64' )
48- bitness = ' 64' ;
49- else
50- bitness = ' 32' ;
51- end
52-
53- if debugging
54- debug = ' -debug' ;
55- else
56- debug = ' ' ;
57- end
58-
59- dll_fname = sprintf(' liblsl%s%s%s ' , bitness , debug , ext );
60- dllpath = fullfile(binarypath , dll_fname );
61-
62- if ~exist(dllpath , ' file' ) && ~ispc
63- new_dllpath = fullfile(' /usr/lib/' , dll_fname );
64- if exist(new_dllpath , ' file' )
65- dllpath = new_dllpath ;
66- end % if
67- end % if
68-
69- if ~exist(dllpath ,' file' )
70- error([' Apparently the file "' dllpath ' " is missing on your computer. Cannot load the lab streaming layer.' ]);
71- end
40+ dllpath = lsl_get_dll(binarypath , debugging );
7241
7342 % open the library and make sure that it gets auto-deleted when the handle is erased
7443 try
You can’t perform that action at this time.
0 commit comments