annotate erlang/erldc/test/call_SUITE.erl @ 27:18e1f1bb1945

- 1.1 update
author Tassilo Philipp
date Sun, 12 Jan 2020 12:10:38 +0100
parents 0cfcc391201f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
1 %% Copyright (c) 2014 Erik Mackdanz <erikmack@gmail.com>
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
2
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
3 %% Permission to use, copy, modify, and distribute this software for any
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
4 %% purpose with or without fee is hereby granted, provided that the above
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
5 %% copyright notice and this permission notice appear in all copies.
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
6
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
7 %% THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
8 %% WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
9 %% MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
10 %% ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
11 %% WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
12 %% ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
13 %% OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
14
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
15 -module(call_SUITE).
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
16 -compile(export_all).
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
17
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
18 -define(VMSZ, 1024).
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
19
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
20 all() ->
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
21 [
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
22 ret_double_arg_double,
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
23 arg_double_bad_vm,
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
24 arg_double_bad_vm_2,
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
25 arg_double_bad_vm_3,
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
26 arg_double_bad_arg,
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
27 call_double_bad_vm,
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
28 call_double_bad_sym,
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
29
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
30 ret_float_arg_float,
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
31
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
32 ret_int,
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
33 arg_int,
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
34
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
35 ret_char_arg_char,
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
36 ret_bool_arg_bool,
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
37 ret_bool_arg_bool_2,
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
38 bad_bool_arg,
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
39 ret_short_arg_short,
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
40 ret_long_arg_long,
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
41 ret_longlong_arg_longlong,
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
42
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
43 ret_ptr_arg_int__ret_void_arg_ptr,
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
44 ret_string_arg_string
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
45 ].
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
46
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
47 %% Tests on sqrt
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
48
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
49 ret_double_arg_double(_) ->
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
50 {ok,Libm} = dyncall:load_library("libm"),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
51 {ok,Sqrt} = dyncall:find_symbol(Libm, "sqrt"),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
52 {ok,CallVm} = dyncall:new_call_vm(?VMSZ),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
53 ok = dyncall:arg_double(CallVm,49.0),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
54 {ok,7.0} = dyncall:call_double(CallVm,Sqrt).
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
55
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
56 arg_double_bad_vm(_) ->
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
57 {error,invalid_vm} = dyncall:arg_double(1000,49.0).
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
58
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
59 arg_double_bad_vm_2(_) ->
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
60 {error,invalid_vm} = dyncall:arg_double("Not an int",49.0).
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
61
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
62 arg_double_bad_vm_3(_) ->
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
63 {error,invalid_vm} = dyncall:arg_double(-4,49.0).
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
64
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
65 arg_double_bad_arg(_) ->
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
66 {ok,CallVm} = dyncall:new_call_vm(?VMSZ),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
67 {error,invalid_arg} = dyncall:arg_double(CallVm,"Not a double").
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
68
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
69 call_double_bad_vm(_) ->
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
70 {ok,Libm} = dyncall:load_library("libm"),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
71 {ok,Sqrt} = dyncall:find_symbol(Libm, "sqrt"),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
72 {ok,CallVm} = dyncall:new_call_vm(?VMSZ),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
73 ok = dyncall:arg_double(CallVm,49.0),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
74 {error,invalid_vm} = dyncall:call_double(12,Sqrt). %% assuming 12 is bad after preceding tests
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
75
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
76 call_double_bad_sym(_) ->
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
77 {ok,Libm} = dyncall:load_library("libm"),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
78 {ok,_Sqrt} = dyncall:find_symbol(Libm, "sqrt"),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
79 {ok,CallVm} = dyncall:new_call_vm(?VMSZ),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
80 ok = dyncall:arg_double(CallVm,49.0),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
81 {error,invalid_arg} = dyncall:call_double(CallVm,12). %% assuming 12 is bad after preceding tests
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
82
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
83
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
84 %% Tests on sqrtf
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
85
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
86 ret_float_arg_float(_) ->
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
87 {ok,Libm} = dyncall:load_library("libm"),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
88 {ok,Sqrt} = dyncall:find_symbol(Libm, "sqrtf"),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
89 {ok,CallVm} = dyncall:new_call_vm(?VMSZ),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
90 ok = dyncall:arg_float(CallVm,49.0),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
91 {ok,7.0} = dyncall:call_float(CallVm,Sqrt).
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
92
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
93 %% Tests on ilogb
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
94 ret_int(_) ->
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
95 {ok,Libm} = dyncall:load_library("libm"),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
96 {ok,Exp} = dyncall:find_symbol(Libm, "ilogb"),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
97 {ok,CallVm} = dyncall:new_call_vm(4096),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
98 ok = dyncall:arg_double(CallVm,1024.0),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
99 {ok,10} = dyncall:call_int(CallVm,Exp).
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
100
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
101 %% Tests on ldexp
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
102 arg_int(_) ->
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
103 {ok,Libm} = dyncall:load_library("libm"),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
104 {ok,Exp} = dyncall:find_symbol(Libm, "ldexp"),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
105 {ok,CallVm} = dyncall:new_call_vm(?VMSZ),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
106 ok = dyncall:arg_double(CallVm,3.0),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
107 ok = dyncall:arg_int(CallVm,2),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
108 {ok,12.0} = dyncall:call_double(CallVm,Exp).
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
109
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
110 %% Tests on get_next_char
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
111 ret_char_arg_char(_) ->
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
112 {ok,Libm} = dyncall:load_library("erldc_testtargets"),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
113 {ok,Sym} = dyncall:find_symbol(Libm, "get_next_char"),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
114 {ok,CallVm} = dyncall:new_call_vm(?VMSZ),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
115 ok = dyncall:arg_char(CallVm,$e),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
116 {ok,$f} = dyncall:call_char(CallVm,Sym).
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
117
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
118 %% Tests on is_false
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
119 ret_bool_arg_bool(_) ->
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
120 {ok,Libm} = dyncall:load_library("erldc_testtargets"),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
121 {ok,Sym} = dyncall:find_symbol(Libm, "is_false"),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
122 {ok,CallVm} = dyncall:new_call_vm(?VMSZ),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
123 ok = dyncall:arg_bool(CallVm,true),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
124 {ok,false} = dyncall:call_bool(CallVm,Sym).
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
125
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
126 ret_bool_arg_bool_2(_) ->
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
127 {ok,Libm} = dyncall:load_library("erldc_testtargets"),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
128 {ok,Sym} = dyncall:find_symbol(Libm, "is_false"),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
129 {ok,CallVm} = dyncall:new_call_vm(?VMSZ),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
130 ok = dyncall:arg_bool(CallVm,false),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
131 {ok,true} = dyncall:call_bool(CallVm,Sym).
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
132
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
133 bad_bool_arg(_) ->
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
134 {ok,Libm} = dyncall:load_library("erldc_testtargets"),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
135 {ok,_Sym} = dyncall:find_symbol(Libm, "is_false"),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
136 {ok,CallVm} = dyncall:new_call_vm(?VMSZ),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
137 {error,invalid_arg} = dyncall:arg_bool(CallVm,foobar).
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
138
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
139 %% Tests on times_three
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
140 ret_short_arg_short(_) ->
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
141 {ok,Libm} = dyncall:load_library("erldc_testtargets"),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
142 {ok,Sym} = dyncall:find_symbol(Libm, "times_three"),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
143 {ok,CallVm} = dyncall:new_call_vm(?VMSZ),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
144 ok = dyncall:arg_short(CallVm,7),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
145 {ok,21} = dyncall:call_short(CallVm,Sym).
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
146
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
147 %% Tests on add_nineteen
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
148 ret_long_arg_long(_) ->
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
149 {ok,Libm} = dyncall:load_library("erldc_testtargets"),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
150 {ok,Sym} = dyncall:find_symbol(Libm, "add_nineteen"),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
151 {ok,CallVm} = dyncall:new_call_vm(?VMSZ),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
152 ok = dyncall:arg_long(CallVm,12),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
153 {ok,31} = dyncall:call_long(CallVm,Sym).
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
154
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
155 %% Tests on subtract_four
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
156 ret_longlong_arg_longlong(_) ->
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
157 {ok,Libm} = dyncall:load_library("erldc_testtargets"),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
158 {ok,Sym} = dyncall:find_symbol(Libm, "subtract_four"),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
159 {ok,CallVm} = dyncall:new_call_vm(?VMSZ),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
160 ok = dyncall:arg_longlong(CallVm,15),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
161 {ok,11} = dyncall:call_longlong(CallVm,Sym).
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
162
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
163 %% Tests on coolmalloc/coolfree
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
164 ret_ptr_arg_int__ret_void_arg_ptr(_) ->
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
165 {ok,Lib} = dyncall:load_library("erldc_testtargets"),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
166 {ok,Sym} = dyncall:find_symbol(Lib, "coolmalloc"),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
167 {ok,CallVm} = dyncall:new_call_vm(?VMSZ),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
168 ok = dyncall:arg_int(CallVm,100),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
169 {ok,Ptr} = dyncall:call_ptr(CallVm,Sym),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
170
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
171 %% Comes out as <<>> (opaque)
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
172 %% io:format("Pointer in erl is ~p~n",[Ptr]),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
173
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
174 {ok,Sym2} = dyncall:find_symbol(Lib, "coolsetstr"),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
175 {ok,CallVm2} = dyncall:new_call_vm(?VMSZ),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
176 ok = dyncall:arg_ptr(CallVm2,Ptr),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
177 ok = dyncall:arg_string(CallVm2,"Barbaz"),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
178 ok = dyncall:call_void(CallVm2,Sym2),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
179
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
180 {ok,Sym3} = dyncall:find_symbol(Lib, "coolfree"),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
181 {ok,CallVm3} = dyncall:new_call_vm(?VMSZ),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
182 ok = dyncall:arg_ptr(CallVm3,Ptr),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
183 ok = dyncall:call_void(CallVm3,Sym3).
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
184
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
185 %% Tests on interested_reply
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
186 ret_string_arg_string(_) ->
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
187 {ok,Libm} = dyncall:load_library("erldc_testtargets"),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
188 {ok,Sym} = dyncall:find_symbol(Libm, "interested_reply"),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
189 {ok,CallVm} = dyncall:new_call_vm(?VMSZ),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
190 ok = dyncall:arg_string(CallVm,"Georg"),
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
191 {ok,"Really, Georg? My name is Erik."} = dyncall:call_string(CallVm,Sym).
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
192
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
193