Mercurial > pub > dyncall > bindings
view erlang/erldc/test/linkload_SUITE.erl @ 46:c21d1c2c84e1
- removed pydc.py wrapper overhead (which only called pydcext.so functions, directly, anyways)
* implies renaming pydcext.* to pydc.*
* while at it, iterate directly over args that are passed in (before we did extract fptr, sig and a tuple for the args and iterated over latter afterwards); we might have a tiny perf improvement now
- added type stub as package_data
author | Tassilo Philipp |
---|---|
date | Fri, 13 Nov 2020 14:10:31 +0100 |
parents | 0cfcc391201f |
children |
line wrap: on
line source
%% Copyright (c) 2014 Erik Mackdanz <erikmack@gmail.com> %% Permission to use, copy, modify, and distribute this software for any %% purpose with or without fee is hereby granted, provided that the above %% copyright notice and this permission notice appear in all copies. %% THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES %% WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF %% MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR %% ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES %% WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN %% ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF %% OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -module(linkload_SUITE). -compile(export_all). -define(VMSZ, 1024). all() -> [create_vm, create_vm_badsz, load_lib, no_such_lib, bad_lib, bad_sym, bad_sym_2, load_sym ]. create_vm(_) -> {ok,Vm} = dyncall:new_call_vm(?VMSZ), true = is_binary(Vm). create_vm_badsz(_) -> {error,bad_vm_size} = dyncall:new_call_vm("Hello badarg"). load_lib(_) -> {ok,Lib} = dyncall:load_library("libm"), true = is_binary(Lib). no_such_lib(_) -> {error,lib_not_found} = dyncall:load_library("foobarbaz"). bad_lib(_) -> {error,invalid_lib} = dyncall:load_library(12). bad_sym(_) -> {ok,Lib} = dyncall:load_library("libm"), {error,symbol_not_found} = dyncall:find_symbol(Lib,"bogussymbol"). bad_sym_2(_) -> {ok,Lib} = dyncall:load_library("libm"), {error,invalid_symbol} = dyncall:find_symbol(Lib,9). load_sym(_) -> {ok,Lib} = dyncall:load_library("libm"), {ok,_Partner} = dyncall:find_symbol(Lib,"sqrt").