-
Notifications
You must be signed in to change notification settings - Fork 9
/
alpload.m
50 lines (42 loc) · 1.32 KB
/
alpload.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
function alpapi = alpload(tagname)
% function alpapi = alpload(tagname)
% creates (loads) specific ALP api
%
% function alpapi = alpload(tagname)
%
% tagname is the tag name previously assigned to a registered DLL via alptoolinstall
%
% File information:
% version 1.0 (feb 2014)
% (c) Martin Vogel
% email: [email protected]
%
% Revision history:
% 1.0 (feb 2014) initial release version
%
if nargin < 1 || isempty(tagname)
[selection, ok, salplib] = alplib('select');
if (ok == 0) || (selection == 0) || isempty(salplib)
alpapi = [];
return;
end
else
salplib = alplib('get', tagname);
if isempty(salplib)
alpapi = [];
return;
end
end
apiclass = str2func(salplib.classname);
if salplib.pseudoDLL
alpapi = apiclass(salplib.tag, true);
else
try
alpapi = apiclass(salplib.tag, false);
catch
uiwait(msgbox(sprintf ('Can not load %s, fallback to pseudoDLL mode.', salplib.tag), ...
'Error loading DLL', 'modal'));
alpapi = apiclass(salplib.tag, true);
end
end
end