Code Monkey home page Code Monkey logo

dlib's People

Contributors

alfiedotwtf avatar atouchet avatar daxpedda avatar eijebong avatar elinorbgr avatar francesca64 avatar milkey-mouse avatar spearman avatar valpackett avatar vberger avatar wmedrano avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

dlib's Issues

The macro allows `$ty` to be followed `...` which will be invalid soon

<dlib macros>:6:59: 6:62 warning: `$vargs:ty` may be followed by `...`, which is not allowed for `ty` fragments
<dlib macros>:6 varargs : $ ( fn $ vname : ident ( $ ( $ vargs : ty ) , + ... ) -> $ vret : ty
                                                                          ^~~
<dlib macros>:6:59: 6:62 note: The above warning will be a hard error in the next release.
<dlib macros>:6 varargs : $ ( fn $ vname : ident ( $ ( $ vargs : ty ) , + ... ) -> $ vret : ty

Not sure what the solution is; maybe change the syntax to be c_int, c_int, [...] or something like that.

Warning with Rust master

<dlib macros>:4:1: 4:10 warning: `$stype:ty` may be followed by `functions`, which is not allowed for `ty` fragments
<dlib macros>:4 functions : $ ( fn $ fname : ident ( $ ( $ farg : ty ) , * ) -> $ fret : ty )
                ^~~~~~~~~
<dlib macros>:4:1: 4:10 note: The above warning will be a hard error in the next release.
<dlib macros>:4 functions : $ ( fn $ fname : ident ( $ ( $ farg : ty ) , * ) -> $ fret : ty )
                ^~~~~~~~~

Remove the need for the “Remaining generic in your crate” paragraph in the README?

Random drive-by thought: if external_library generated code like this when not having the dlopen feature:

mod private {
    #[link(name = "foo")]
    extern "C" {
        static me: c_int;
        static you: c_float;
        fn foo() -> c_int;
        fn bar(_: c_int, _: c_float) -> ();
        fn baz(_: *const c_int) -> c_int;
        fn blah(_: c_int, _: c_int, ...) -> *const c_void;
        fn bleh(_: c_int, ...) -> ();
   }

   pub struct Foo {
       pub me: &'static c_int,
       pub you: &'static c_float,
       pub foo: unsafe extern "C" fn() -> c_int,
       pub bar: unsafe extern "C" fn(c_int, c_float) -> (),
       pub baz: unsafe extern "C" fn(*const c_int) -> c_int,
       pub blah: unsafe extern "C" fn(c_int, c_int, ...) -> *const c_void,
       pub bleh: unsafe extern "C" fn(c_int, ...) -> (),
    }

    impl Foo {
        pub fn open(_: Option<&str>) -> Result<Foo, DlError> { /* ... */ }
    }
}
use private::Foo;

Then the user could just always use Foo::open(find_solib_or_none("foo.so")).foo(), without having to care about the dlopen feature?

It'd probably also reduce a bit the issue with the dlopen feature, which is that currently it's not additive.

That said it would still not really be, but if Foo::open(None) with the dlopen feature searched in the so path… then maybe it'd actually become kind of additive? (still not perfectly so, but at least for all reasonable users that either pass a valid Some(lib) or None it'd be)

Outdated dependency

I noticed during building an application that uses winit, that serde_json 0.9.10 (which is pre-1.0 and no longer supported) is still used by libloading 0.3.4 (currently used by this crate). libloading 0.4.0 no longer requires the now deprecated target_build_utils crate (the API hasn't changed AFAICT), so the old serde_json version is no longer used, but libloading 0.4 requires at least rustc 1.14. According to crates.io, the main users of this crate is the various Wayland-related crates and winit, so updating libloading means for most of the GUI related stuff rustc 1.14 (released in last december) is a new minimal requirement. Is it acceptable?

impl Send + Sync

I have a use case in which one of my libraries (aurum-display) would benefit from implementing Send and Sync for structs defined with external_library!. I'd like to be able to open a library once and share it between multiple threads. Since all functions are loaded at once (rather than lazily), this shouldn't cause any problems that I can forsee. The same has been done in x11-dl. If you're up for this, I can open a pull request. The change would only be a few lines added.

Relicense under dual MIT/Apache-2.0

This issue was automatically generated. Feel free to close without ceremony if
you do not agree with re-licensing or if it is not possible for other reasons.
Respond to @cmr with any questions or concerns, or pop over to
#rust-offtopic on IRC to discuss.

You're receiving this because someone (perhaps the project maintainer)
published a crates.io package with the license as "MIT" xor "Apache-2.0" and
the repository field pointing here.

TL;DR the Rust ecosystem is largely Apache-2.0. Being available under that
license is good for interoperation. The MIT license as an add-on can be nice
for GPLv2 projects to use your code.

Why?

The MIT license requires reproducing countless copies of the same copyright
header with different names in the copyright field, for every MIT library in
use. The Apache license does not have this drawback. However, this is not the
primary motivation for me creating these issues. The Apache license also has
protections from patent trolls and an explicit contribution licensing clause.
However, the Apache license is incompatible with GPLv2. This is why Rust is
dual-licensed as MIT/Apache (the "primary" license being Apache, MIT only for
GPLv2 compat), and doing so would be wise for this project. This also makes
this crate suitable for inclusion and unrestricted sharing in the Rust
standard distribution and other projects using dual MIT/Apache, such as my
personal ulterior motive, the Robigalia project.

Some ask, "Does this really apply to binary redistributions? Does MIT really
require reproducing the whole thing?" I'm not a lawyer, and I can't give legal
advice, but some Google Android apps include open source attributions using
this interpretation. Others also agree with
it
.
But, again, the copyright notice redistribution is not the primary motivation
for the dual-licensing. It's stronger protections to licensees and better
interoperation with the wider Rust ecosystem.

How?

To do this, get explicit approval from each contributor of copyrightable work
(as not all contributions qualify for copyright, due to not being a "creative
work", e.g. a typo fix) and then add the following to your README:

## License

Licensed under either of

 * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
 * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)

at your option.

### Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any
additional terms or conditions.

and in your license headers, if you have them, use the following boilerplate
(based on that used in Rust):

// Copyright 2016 dlib Developers
//
// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
// http://opensource.org/licenses/MIT>, at your option. This file may not be
// copied, modified, or distributed except according to those terms.

It's commonly asked whether license headers are required. I'm not comfortable
making an official recommendation either way, but the Apache license
recommends it in their appendix on how to use the license.

Be sure to add the relevant LICENSE-{MIT,APACHE} files. You can copy these
from the Rust repo for a plain-text
version.

And don't forget to update the license metadata in your Cargo.toml to:

license = "MIT OR Apache-2.0"

I'll be going through projects which agree to be relicensed and have approval
by the necessary contributors and doing this changes, so feel free to leave
the heavy lifting to me!

Contributor checkoff

To agree to relicensing, comment with :

I license past and future contributions under the dual MIT/Apache-2.0 license, allowing licensees to chose either at their option.

Or, if you're a contributor, you can check the box in this repo next to your
name. My scripts will pick this exact phrase up and check your checkbox, but
I'll come through and manually review this issue later as well.

Macro trouble

/home/servo/.cargo/registry/src/github.com-0a35038f75765ae4/dlib-0.2.0/src/lib.rs:41:11: 41:20 warning: `$stype:ty` may be followed by `functions`, which is not allowed for `ty` fragments
/home/servo/.cargo/registry/src/github.com-0a35038f75765ae4/dlib-0.2.0/src/lib.rs:41:11: 41:20 note: The above warning will be a hard error in the next release.
/home/servo/.cargo/registry/src/github.com-0a35038f75765ae4/dlib-0.2.0/src/lib.rs:42:11: 42:18 warning: `$stype:ty` may be followed by `varargs`, which is not allowed for `ty` fragments
/home/servo/.cargo/registry/src/github.com-0a35038f75765ae4/dlib-0.2.0/src/lib.rs:42:11: 42:18 note: The above warning will be a hard error in the next release.
/home/servo/.cargo/registry/src/github.com-0a35038f75765ae4/dlib-0.2.0/src/lib.rs:42:11: 42:18 warning: `$fret:ty` may be followed by `varargs`, which is not allowed for `ty` fragments
/home/servo/.cargo/registry/src/github.com-0a35038f75765ae4/dlib-0.2.0/src/lib.rs:42:11: 42:18 note: The above warning will be a hard error in the next release.
/home/servo/.cargo/registry/src/github.com-0a35038f75765ae4/dlib-0.2.0/src/lib.rs:42:55: 42:58 warning: `$vargs:ty` may be followed by `...`, which is not allowed for `ty` fragments
/home/servo/.cargo/registry/src/github.com-0a35038f75765ae4/dlib-0.2.0/src/lib.rs:42:55: 42:58 note: The above warning will be a hard error in the next release.
/home/servo/.cargo/registry/src/github.com-0a35038f75765ae4/dlib-0.2.0/src/lib.rs:68:11: 68:20 warning: `$stype:ty` may be followed by `functions`, which is not allowed for `ty` fragments
/home/servo/.cargo/registry/src/github.com-0a35038f75765ae4/dlib-0.2.0/src/lib.rs:68:11: 68:20 note: The above warning will be a hard error in the next release.
/home/servo/.cargo/registry/src/github.com-0a35038f75765ae4/dlib-0.2.0/src/lib.rs:69:11: 69:18 warning: `$stype:ty` may be followed by `varargs`, which is not allowed for `ty` fragments
/home/servo/.cargo/registry/src/github.com-0a35038f75765ae4/dlib-0.2.0/src/lib.rs:69:11: 69:18 note: The above warning will be a hard error in the next release.
/home/servo/.cargo/registry/src/github.com-0a35038f75765ae4/dlib-0.2.0/src/lib.rs:69:11: 69:18 warning: `$fret:ty` may be followed by `varargs`, which is not allowed for `ty` fragments
/home/servo/.cargo/registry/src/github.com-0a35038f75765ae4/dlib-0.2.0/src/lib.rs:69:11: 69:18 note: The above warning will be a hard error in the next release.
/home/servo/.cargo/registry/src/github.com-0a35038f75765ae4/dlib-0.2.0/src/lib.rs:69:55: 69:58 warning: `$vargs:ty` may be followed by `...`, which is not allowed for `ty` fragments
/home/servo/.cargo/registry/src/github.com-0a35038f75765ae4/dlib-0.2.0/src/lib.rs:69:55: 69:58 note: The above warning will be a hard error in the next release.
/home/servo/.cargo/registry/src/github.com-0a35038f75765ae4/dlib-0.2.0/src/lib.rs:86:11: 86:20 warning: `$stype:ty` may be followed by `functions`, which is not allowed for `ty` fragments
/home/servo/.cargo/registry/src/github.com-0a35038f75765ae4/dlib-0.2.0/src/lib.rs:86:11: 86:20 note: The above warning will be a hard error in the next release.
/home/servo/.cargo/registry/src/github.com-0a35038f75765ae4/dlib-0.2.0/src/lib.rs:87:11: 87:18 warning: `$stype:ty` may be followed by `varargs`, which is not allowed for `ty` fragments
/home/servo/.cargo/registry/src/github.com-0a35038f75765ae4/dlib-0.2.0/src/lib.rs:87:11: 87:18 note: The above warning will be a hard error in the next release.
/home/servo/.cargo/registry/src/github.com-0a35038f75765ae4/dlib-0.2.0/src/lib.rs:87:11: 87:18 warning: `$fret:ty` may be followed by `varargs`, which is not allowed for `ty` fragments
/home/servo/.cargo/registry/src/github.com-0a35038f75765ae4/dlib-0.2.0/src/lib.rs:87:11: 87:18 note: The above warning will be a hard error in the next release.
/home/servo/.cargo/registry/src/github.com-0a35038f75765ae4/dlib-0.2.0/src/lib.rs:87:55: 87:58 warning: `$vargs:ty` may be followed by `...`, which is not allowed for `ty` fragments
/home/servo/.cargo/registry/src/github.com-0a35038f75765ae4/dlib-0.2.0/src/lib.rs:87:55: 87:58 note: The above warning will be a hard error in the next release.
/home/servo/.cargo/registry/src/github.com-0a35038f75765ae4/dlib-0.2.0/src/lib.rs:132:11: 132:20 warning: `$stype:ty` may be followed by `functions`, which is not allowed for `ty` fragments
/home/servo/.cargo/registry/src/github.com-0a35038f75765ae4/dlib-0.2.0/src/lib.rs:132:11: 132:20 note: The above warning will be a hard error in the next release.
/home/servo/.cargo/registry/src/github.com-0a35038f75765ae4/dlib-0.2.0/src/lib.rs:133:11: 133:18 warning: `$stype:ty` may be followed by `varargs`, which is not allowed for `ty` fragments
/home/servo/.cargo/registry/src/github.com-0a35038f75765ae4/dlib-0.2.0/src/lib.rs:133:11: 133:18 note: The above warning will be a hard error in the next release.
/home/servo/.cargo/registry/src/github.com-0a35038f75765ae4/dlib-0.2.0/src/lib.rs:133:11: 133:18 warning: `$fret:ty` may be followed by `varargs`, which is not allowed for `ty` fragments
/home/servo/.cargo/registry/src/github.com-0a35038f75765ae4/dlib-0.2.0/src/lib.rs:133:11: 133:18 note: The above warning will be a hard error in the next release.
/home/servo/.cargo/registry/src/github.com-0a35038f75765ae4/dlib-0.2.0/src/lib.rs:133:55: 133:58 warning: `$vargs:ty` may be followed by `...`, which is not allowed for `ty` fragments
/home/servo/.cargo/registry/src/github.com-0a35038f75765ae4/dlib-0.2.0/src/lib.rs:133:55: 133:58 note: The above warning will be a hard error in the next release.
/home/servo/.cargo/registry/src/github.com-0a35038f75765ae4/dlib-0.2.0/src/lib.rs:170:11: 170:20 warning: `$stype:ty` may be followed by `functions`, which is not allowed for `ty` fragments
/home/servo/.cargo/registry/src/github.com-0a35038f75765ae4/dlib-0.2.0/src/lib.rs:170:11: 170:20 note: The above warning will be a hard error in the next release.
/home/servo/.cargo/registry/src/github.com-0a35038f75765ae4/dlib-0.2.0/src/lib.rs:171:11: 171:18 warning: `$stype:ty` may be followed by `varargs`, which is not allowed for `ty` fragments
/home/servo/.cargo/registry/src/github.com-0a35038f75765ae4/dlib-0.2.0/src/lib.rs:171:11: 171:18 note: The above warning will be a hard error in the next release.
/home/servo/.cargo/registry/src/github.com-0a35038f75765ae4/dlib-0.2.0/src/lib.rs:171:11: 171:18 warning: `$fret:ty` may be followed by `varargs`, which is not allowed for `ty` fragments
/home/servo/.cargo/registry/src/github.com-0a35038f75765ae4/dlib-0.2.0/src/lib.rs:171:11: 171:18 note: The above warning will be a hard error in the next release.
/home/servo/.cargo/registry/src/github.com-0a35038f75765ae4/dlib-0.2.0/src/lib.rs:171:55: 171:58 warning: `$vargs:ty` may be followed by `...`, which is not allowed for `ty` fragments
/home/servo/.cargo/registry/src/github.com-0a35038f75765ae4/dlib-0.2.0/src/lib.rs:171:55: 171:58 note: The above warning will be a hard error in the next release.
<dlib macros>:4:1: 4:10 warning: `$stype:ty` may be followed by `functions`, which is not allowed for `ty` fragments
<dlib macros>:4:1: 4:10 note: The above warning will be a hard error in the next release.
<dlib macros>:6:1: 6:8 warning: `$stype:ty` may be followed by `varargs`, which is not allowed for `ty` fragments
<dlib macros>:6:1: 6:8 note: The above warning will be a hard error in the next release.
<dlib macros>:6:1: 6:8 warning: `$fret:ty` may be followed by `varargs`, which is not allowed for `ty` fragments
<dlib macros>:6:1: 6:8 note: The above warning will be a hard error in the next release.
<dlib macros>:6:59: 6:62 warning: `$vargs:ty` may be followed by `...`, which is not allowed for `ty` fragments
<dlib macros>:6:59: 6:62 note: The above warning will be a hard error in the next release.
<dlib macros>:4:1: 4:10 warning: `$stype:ty` may be followed by `functions`, which is not allowed for `ty` fragments
<dlib macros>:4:1: 4:10 note: The above warning will be a hard error in the next release.
<dlib macros>:6:1: 6:8 warning: `$stype:ty` may be followed by `varargs`, which is not allowed for `ty` fragments
<dlib macros>:6:1: 6:8 note: The above warning will be a hard error in the next release.
<dlib macros>:6:1: 6:8 warning: `$fret:ty` may be followed by `varargs`, which is not allowed for `ty` fragments
<dlib macros>:6:1: 6:8 note: The above warning will be a hard error in the next release.
<dlib macros>:6:59: 6:62 warning: `$vargs:ty` may be followed by `...`, which is not allowed for `ty` fragments
<dlib macros>:6:59: 6:62 note: The above warning will be a hard error in the next release.
<dlib macros>:20:1: 20:10 warning: `$stype:ty` may be followed by `functions`, which is not allowed for `ty` fragments
<dlib macros>:20:1: 20:10 note: The above warning will be a hard error in the next release.
<dlib macros>:22:1: 22:8 warning: `$stype:ty` may be followed by `varargs`, which is not allowed for `ty` fragments
<dlib macros>:22:1: 22:8 note: The above warning will be a hard error in the next release.
<dlib macros>:22:1: 22:8 warning: `$fret:ty` may be followed by `varargs`, which is not allowed for `ty` fragments
<dlib macros>:22:1: 22:8 note: The above warning will be a hard error in the next release.
<dlib macros>:22:59: 22:62 warning: `$vargs:ty` may be followed by `...`, which is not allowed for `ty` fragments
<dlib macros>:22:59: 22:62 note: The above warning will be a hard error in the next release.
<dlib macros>:54:1: 54:10 warning: `$stype:ty` may be followed by `functions`, which is not allowed for `ty` fragments
<dlib macros>:54:1: 54:10 note: The above warning will be a hard error in the next release.
<dlib macros>:56:1: 56:8 warning: `$stype:ty` may be followed by `varargs`, which is not allowed for `ty` fragments
<dlib macros>:56:1: 56:8 note: The above warning will be a hard error in the next release.
<dlib macros>:56:1: 56:8 warning: `$fret:ty` may be followed by `varargs`, which is not allowed for `ty` fragments
<dlib macros>:56:1: 56:8 note: The above warning will be a hard error in the next release.
<dlib macros>:56:59: 56:62 warning: `$vargs:ty` may be followed by `...`, which is not allowed for `ty` fragments
<dlib macros>:56:59: 56:62 note: The above warning will be a hard error in the next release.
<dlib macros>:4:1: 4:10 warning: `$stype:ty` may be followed by `functions`, which is not allowed for `ty` fragments
<dlib macros>:4:1: 4:10 note: The above warning will be a hard error in the next release.
<dlib macros>:6:1: 6:8 warning: `$stype:ty` may be followed by `varargs`, which is not allowed for `ty` fragments
<dlib macros>:6:1: 6:8 note: The above warning will be a hard error in the next release.
<dlib macros>:6:1: 6:8 warning: `$fret:ty` may be followed by `varargs`, which is not allowed for `ty` fragments
<dlib macros>:6:1: 6:8 note: The above warning will be a hard error in the next release.
<dlib macros>:6:59: 6:62 warning: `$vargs:ty` may be followed by `...`, which is not allowed for `ty` fragments
<dlib macros>:6:59: 6:62 note: The above warning will be a hard error in the next release.
/home/servo/.cargo/registry/src/github.com-0a35038f75765ae4/x11-2.3.0/src/lib.rs:9:10: 9:28 warning: lint raw_pointer_derive has been removed: using derive with raw pointers is ok
<dlib macros>:4:1: 4:10 warning: `$stype:ty` may be followed by `functions`, which is not allowed for `ty` fragments
<dlib macros>:4:1: 4:10 note: The above warning will be a hard error in the next release.
<dlib macros>:6:1: 6:8 warning: `$stype:ty` may be followed by `varargs`, which is not allowed for `ty` fragments
<dlib macros>:6:1: 6:8 note: The above warning will be a hard error in the next release.
<dlib macros>:6:1: 6:8 warning: `$fret:ty` may be followed by `varargs`, which is not allowed for `ty` fragments
<dlib macros>:6:1: 6:8 note: The above warning will be a hard error in the next release.
<dlib macros>:6:59: 6:62 warning: `$vargs:ty` may be followed by `...`, which is not allowed for `ty` fragments
<dlib macros>:6:59: 6:62 note: The above warning will be a hard error in the next release.
<dlib macros>:4:1: 4:10 warning: `$stype:ty` may be followed by `functions`, which is not allowed for `ty` fragments
<dlib macros>:4:1: 4:10 note: The above warning will be a hard error in the next release.
<dlib macros>:6:1: 6:8 warning: `$stype:ty` may be followed by `varargs`, which is not allowed for `ty` fragments
<dlib macros>:6:1: 6:8 note: The above warning will be a hard error in the next release.
<dlib macros>:6:1: 6:8 warning: `$fret:ty` may be followed by `varargs`, which is not allowed for `ty` fragments
<dlib macros>:6:1: 6:8 note: The above warning will be a hard error in the next release.
<dlib macros>:6:59: 6:62 warning: `$vargs:ty` may be followed by `...`, which is not allowed for `ty` fragments
<dlib macros>:6:59: 6:62 note: The above warning will be a hard error in the next release.
<dlib macros>:20:1: 20:10 warning: `$stype:ty` may be followed by `functions`, which is not allowed for `ty` fragments
<dlib macros>:20:1: 20:10 note: The above warning will be a hard error in the next release.
<dlib macros>:22:1: 22:8 warning: `$stype:ty` may be followed by `varargs`, which is not allowed for `ty` fragments
<dlib macros>:22:1: 22:8 note: The above warning will be a hard error in the next release.
<dlib macros>:22:1: 22:8 warning: `$fret:ty` may be followed by `varargs`, which is not allowed for `ty` fragments
<dlib macros>:22:1: 22:8 note: The above warning will be a hard error in the next release.
<dlib macros>:22:59: 22:62 warning: `$vargs:ty` may be followed by `...`, which is not allowed for `ty` fragments
<dlib macros>:22:59: 22:62 note: The above warning will be a hard error in the next release.
<dlib macros>:54:1: 54:10 warning: `$stype:ty` may be followed by `functions`, which is not allowed for `ty` fragments
<dlib macros>:54:1: 54:10 note: The above warning will be a hard error in the next release.
<dlib macros>:56:1: 56:8 warning: `$stype:ty` may be followed by `varargs`, which is not allowed for `ty` fragments
<dlib macros>:56:1: 56:8 note: The above warning will be a hard error in the next release.
<dlib macros>:56:1: 56:8 warning: `$fret:ty` may be followed by `varargs`, which is not allowed for `ty` fragments
<dlib macros>:56:1: 56:8 note: The above warning will be a hard error in the next release.
<dlib macros>:56:59: 56:62 warning: `$vargs:ty` may be followed by `...`, which is not allowed for `ty` fragments
<dlib macros>:56:59: 56:62 note: The above warning will be a hard error in the next release.
<dlib macros>:4:1: 4:10 warning: `$stype:ty` may be followed by `functions`, which is not allowed for `ty` fragments
<dlib macros>:4:1: 4:10 note: The above warning will be a hard error in the next release.
<dlib macros>:6:1: 6:8 warning: `$stype:ty` may be followed by `varargs`, which is not allowed for `ty` fragments
<dlib macros>:6:1: 6:8 note: The above warning will be a hard error in the next release.
<dlib macros>:6:1: 6:8 warning: `$fret:ty` may be followed by `varargs`, which is not allowed for `ty` fragments
<dlib macros>:6:1: 6:8 note: The above warning will be a hard error in the next release.
<dlib macros>:6:59: 6:62 warning: `$vargs:ty` may be followed by `...`, which is not allowed for `ty` fragments
<dlib macros>:6:59: 6:62 note: The above warning will be a hard error in the next release.
<dlib macros>:4:1: 4:10 warning: `$stype:ty` may be followed by `functions`, which is not allowed for `ty` fragments
<dlib macros>:4:1: 4:10 note: The above warning will be a hard error in the next release.
<dlib macros>:6:1: 6:8 warning: `$stype:ty` may be followed by `varargs`, which is not allowed for `ty` fragments
<dlib macros>:6:1: 6:8 note: The above warning will be a hard error in the next release.
<dlib macros>:6:1: 6:8 warning: `$fret:ty` may be followed by `varargs`, which is not allowed for `ty` fragments
<dlib macros>:6:1: 6:8 note: The above warning will be a hard error in the next release.
<dlib macros>:6:59: 6:62 warning: `$vargs:ty` may be followed by `...`, which is not allowed for `ty` fragments
<dlib macros>:6:59: 6:62 note: The above warning will be a hard error in the next release.
<dlib macros>:4:1: 4:10 warning: `$stype:ty` may be followed by `functions`, which is not allowed for `ty` fragments
<dlib macros>:4:1: 4:10 note: The above warning will be a hard error in the next release.
<dlib macros>:6:1: 6:8 warning: `$stype:ty` may be followed by `varargs`, which is not allowed for `ty` fragments
<dlib macros>:6:1: 6:8 note: The above warning will be a hard error in the next release.
<dlib macros>:6:1: 6:8 warning: `$fret:ty` may be followed by `varargs`, which is not allowed for `ty` fragments
<dlib macros>:6:1: 6:8 note: The above warning will be a hard error in the next release.
<dlib macros>:6:59: 6:62 warning: `$vargs:ty` may be followed by `...`, which is not allowed for `ty` fragments
<dlib macros>:6:59: 6:62 note: The above warning will be a hard error in the next release.
<dlib macros>:20:1: 20:10 warning: `$stype:ty` may be followed by `functions`, which is not allowed for `ty` fragments
<dlib macros>:20:1: 20:10 note: The above warning will be a hard error in the next release.
<dlib macros>:22:1: 22:8 warning: `$stype:ty` may be followed by `varargs`, which is not allowed for `ty` fragments
<dlib macros>:22:1: 22:8 note: The above warning will be a hard error in the next release.
<dlib macros>:22:1: 22:8 warning: `$fret:ty` may be followed by `varargs`, which is not allowed for `ty` fragments
<dlib macros>:22:1: 22:8 note: The above warning will be a hard error in the next release.
<dlib macros>:22:59: 22:62 warning: `$vargs:ty` may be followed by `...`, which is not allowed for `ty` fragments
<dlib macros>:22:59: 22:62 note: The above warning will be a hard error in the next release.
<dlib macros>:54:1: 54:10 warning: `$stype:ty` may be followed by `functions`, which is not allowed for `ty` fragments
<dlib macros>:54:1: 54:10 note: The above warning will be a hard error in the next release.
<dlib macros>:56:1: 56:8 warning: `$stype:ty` may be followed by `varargs`, which is not allowed for `ty` fragments
<dlib macros>:56:1: 56:8 note: The above warning will be a hard error in the next release.
<dlib macros>:56:1: 56:8 warning: `$fret:ty` may be followed by `varargs`, which is not allowed for `ty` fragments
<dlib macros>:56:1: 56:8 note: The above warning will be a hard error in the next release.
<dlib macros>:56:59: 56:62 warning: `$vargs:ty` may be followed by `...`, which is not allowed for `ty` fragments
<dlib macros>:56:59: 56:62 note: The above warning will be a hard error in the next release.
<dlib macros>:4:1: 4:10 warning: `$stype:ty` may be followed by `functions`, which is not allowed for `ty` fragments
<dlib macros>:4:1: 4:10 note: The above warning will be a hard error in the next release.
<dlib macros>:6:1: 6:8 warning: `$stype:ty` may be followed by `varargs`, which is not allowed for `ty` fragments
<dlib macros>:6:1: 6:8 note: The above warning will be a hard error in the next release.
<dlib macros>:6:1: 6:8 warning: `$fret:ty` may be followed by `varargs`, which is not allowed for `ty` fragments
<dlib macros>:6:1: 6:8 note: The above warning will be a hard error in the next release.
<dlib macros>:6:59: 6:62 warning: `$vargs:ty` may be followed by `...`, which is not allowed for `ty` fragments
<dlib macros>:6:59: 6:62 note: The above warning will be a hard error in the next release.

Doc tests failing

Hi,
the doc tests are failing when I attempted to build the crate on GNU Guix.

This seems to be caused due to incorrect import use ffi::*; instead of use std::ffi::*;.

Here's patch

From 4070a0e22c405447a79aea5545edb7107d6c229a Mon Sep 17 00:00:00 2001
From: Petr Hodina <[email protected]>
Date: Sat, 16 Apr 2022 14:58:53 +0200
Subject: [PATCH] Fix doc tests by importing correctly ffi crate.


diff --git a/src/lib.rs b/src/lib.rs
index b1ab52a..7693bcd 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -125,7 +125,7 @@
 //! #[cfg(feature = "dlopen-foo")]
 //! use ffi::FOO_STATIC;
 //! #[cfg(not(feature = "dlopen-foo"))]
-//! use ffi::*;
+//! use std::ffi::*;
 //! ```
 #![warn(missing_docs)]

--
2.35.1

However, there is issue with macro?

starting phase `check'
   Compiling dlib v0.5.0 (/tmp/guix-build-rust-dlib-0.5.0.drv-0/dlib-0.5.0)
    Finished release [optimized] target(s) in 0.26s
     Running unittests (target/release/deps/dlib-9c1fce15507bcc0c)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests dlib

running 9 tests
test src/lib.rs - ffi_dispatch (line 154) ... ignored
test src/lib.rs - ffi_dispatch_static (line 188) ... ignored
test src/lib.rs - (line 8) ... FAILED
test src/lib.rs - (line 93) ... FAILED
test src/lib.rs - (line 102) ... FAILED
test src/lib.rs - (line 31) ... FAILED
test src/lib.rs - (line 49) ... FAILED
test src/lib.rs - (line 124) ... ok
test src/lib.rs - (line 114) ... ok

failures:

---- src/lib.rs - (line 8) stdout ----
error: cannot find macro `external_library` in this scope
 --> src/lib.rs:9:1
  |
3 | external_library!(feature="dlopen-foo", Foo, "foo",
  | ^^^^^^^^^^^^^^^^

error: aborting due to previous error

Couldn't compile the test.
---- src/lib.rs - (line 93) stdout ----
error: cannot find macro `external_library` in this scope
 --> src/lib.rs:94:1
  |
3 | external_library!(feature="dlopen-foo", Foo, "foo",
  | ^^^^^^^^^^^^^^^^

error: aborting due to previous error

Couldn't compile the test.
---- src/lib.rs - (line 102) stdout ----
error: cannot find macro `ffi_dispatch_static` in this scope
 --> src/lib.rs:104:1
  |
4 | ffi_dispatch_static!(feature="dlopen-foo", Foo, my_static_var);
  | ^^^^^^^^^^^^^^^^^^^

error: cannot find macro `ffi_dispatch` in this scope
 --> src/lib.rs:103:1
  |
3 | ffi_dispatch!(feature="dlopen-foo", Foo, function, arg1, arg2);
  | ^^^^^^^^^^^^

error: aborting due to 2 previous errors

Couldn't compile the test.
---- src/lib.rs - (line 31) stdout ----
error[E0412]: cannot find type `c_int` in this scope
 --> src/lib.rs:34:20
  |
5 |     pub static me: c_int;
  |                    ^^^^^ not found in this scope
  |
help: consider importing this type alias
  |
2 | use std::os::raw::c_int;
  |

error[E0412]: cannot find type `c_float` in this scope
 --> src/lib.rs:35:21
  |
6 |     pub static you: c_float;
  |                     ^^^^^^^ not found in this scope
  |
help: consider importing this type alias
  |
2 | use std::os::raw::c_float;
  |

error[E0412]: cannot find type `c_int` in this scope
 --> src/lib.rs:36:21
  |
7 |     pub fn foo() -> c_int;
  |                     ^^^^^ not found in this scope
  |
help: consider importing this type alias
  |
2 | use std::os::raw::c_int;
  |

error[E0412]: cannot find type `c_int` in this scope
 --> src/lib.rs:37:19
  |
8 |     pub fn bar(_: c_int, _: c_float) -> ();
  |                   ^^^^^ not found in this scope
  |
help: consider importing this type alias
  |
2 | use std::os::raw::c_int;
  |

error[E0412]: cannot find type `c_float` in this scope
 --> src/lib.rs:37:29
  |
8 |     pub fn bar(_: c_int, _: c_float) -> ();
  |                             ^^^^^^^ not found in this scope
  |
help: consider importing this type alias
  |
2 | use std::os::raw::c_float;
  |

error[E0412]: cannot find type `c_int` in this scope
 --> src/lib.rs:38:26
  |
9 |     pub fn baz(_: *const c_int) -> c_int;
  |                          ^^^^^ not found in this scope
  |
help: consider importing this type alias
  |
2 | use std::os::raw::c_int;
  |

error[E0412]: cannot find type `c_int` in this scope
 --> src/lib.rs:38:36
  |
9 |     pub fn baz(_: *const c_int) -> c_int;
  |                                    ^^^^^ not found in this scope
  |
help: consider importing this type alias
  |
2 | use std::os::raw::c_int;
  |

error[E0412]: cannot find type `c_int` in this scope
  --> src/lib.rs:39:20
   |
10 |     pub fn blah(_: c_int, _: c_int, ...) -> *const c_void;
   |                    ^^^^^ not found in this scope
   |
help: consider importing this type alias
   |
2  | use std::os::raw::c_int;
   |

error[E0412]: cannot find type `c_int` in this scope
  --> src/lib.rs:39:30
   |
10 |     pub fn blah(_: c_int, _: c_int, ...) -> *const c_void;
   |                              ^^^^^ not found in this scope
   |
help: consider importing this type alias
   |
2  | use std::os::raw::c_int;
   |

error[E0412]: cannot find type `c_void` in this scope
  --> src/lib.rs:39:52
   |
10 |     pub fn blah(_: c_int, _: c_int, ...) -> *const c_void;
   |                                                    ^^^^^^ not found in this scope
   |
help: consider importing this enum
   |
2  | use std::os::raw::c_void;
   |

error[E0412]: cannot find type `c_int` in this scope
  --> src/lib.rs:40:20
   |
11 |     pub fn bleh(_: c_int, ...) -> ();
   |                    ^^^^^ not found in this scope
   |
help: consider importing this type alias
   |
2  | use std::os::raw::c_int;
   |

error: aborting due to 11 previous errors

For more information about this error, try `rustc --explain E0412`.
Couldn't compile the test.
---- src/lib.rs - (line 49) stdout ----
error[E0412]: cannot find type `c_int` in this scope
 --> src/lib.rs:51:22
  |
4 |     pub me: &'static c_int,
  |                      ^^^^^ not found in this scope
  |
help: consider importing this type alias
  |
2 | use std::os::raw::c_int;
  |

error[E0412]: cannot find type `c_float` in this scope
 --> src/lib.rs:52:23
  |
5 |     pub you: &'static c_float,
  |                       ^^^^^^^ not found in this scope
  |
help: consider importing this type alias
  |
2 | use std::os::raw::c_float;
  |

error[E0412]: cannot find type `c_int` in this scope
 --> src/lib.rs:53:40
  |
6 |     pub foo: unsafe extern "C" fn() -> c_int,
  |                                        ^^^^^ not found in this scope
  |
help: consider importing this type alias
  |
2 | use std::os::raw::c_int;
  |

error[E0412]: cannot find type `c_int` in this scope
 --> src/lib.rs:54:35
  |
7 |     pub bar: unsafe extern "C" fn(c_int, c_float) -> (),
  |                                   ^^^^^ not found in this scope
  |
help: consider importing this type alias
  |
2 | use std::os::raw::c_int;
  |

error[E0412]: cannot find type `c_float` in this scope
 --> src/lib.rs:54:42
  |
7 |     pub bar: unsafe extern "C" fn(c_int, c_float) -> (),
  |                                          ^^^^^^^ not found in this scope
  |
help: consider importing this type alias
  |
2 | use std::os::raw::c_float;
  |

error[E0412]: cannot find type `c_int` in this scope
 --> src/lib.rs:55:42
  |
8 |     pub baz: unsafe extern "C" fn(*const c_int) -> c_int,
  |                                          ^^^^^ not found in this scope
  |
help: consider importing this type alias
  |
2 | use std::os::raw::c_int;
  |

error[E0412]: cannot find type `c_int` in this scope
 --> src/lib.rs:55:52
  |
8 |     pub baz: unsafe extern "C" fn(*const c_int) -> c_int,
  |                                                    ^^^^^ not found in this scope
  |
help: consider importing this type alias
  |
2 | use std::os::raw::c_int;
  |

error[E0412]: cannot find type `c_int` in this scope
 --> src/lib.rs:56:36
  |
9 |     pub blah: unsafe extern "C" fn(c_int, c_int, ...) -> *const c_void,
  |                                    ^^^^^ not found in this scope
  |
help: consider importing this type alias
  |
2 | use std::os::raw::c_int;
  |

error[E0412]: cannot find type `c_int` in this scope
 --> src/lib.rs:56:43
  |
9 |     pub blah: unsafe extern "C" fn(c_int, c_int, ...) -> *const c_void,
  |                                           ^^^^^ not found in this scope
  |
help: consider importing this type alias
  |
2 | use std::os::raw::c_int;
  |

error[E0412]: cannot find type `c_void` in this scope
 --> src/lib.rs:56:65
  |
9 |     pub blah: unsafe extern "C" fn(c_int, c_int, ...) -> *const c_void,
  |                                                                 ^^^^^^ not found in this scope
  |
help: consider importing this enum
  |
2 | use std::os::raw::c_void;
  |

error[E0412]: cannot find type `c_int` in this scope
  --> src/lib.rs:57:36
   |
10 |     pub bleh: unsafe extern "C" fn(c_int, ...) -> (),
   |                                    ^^^^^ not found in this scope
   |
help: consider importing this type alias
   |
2  | use std::os::raw::c_int;
   |

error[E0412]: cannot find type `DlError` in this scope
  --> src/lib.rs:62:51
   |
14 | impl Foo {
   |     - help: you might be missing a type parameter: `<DlError>`
15 |     pub unsafe fn open(name: &str) -> Result<Foo, DlError> { /* ... */ }
   |                                                   ^^^^^^^ not found in this scope

error: aborting due to 12 previous errors

For more information about this error, try `rustc --explain E0412`.
Couldn't compile the test.

failures:
    src/lib.rs - (line 102)
    src/lib.rs - (line 31)
    src/lib.rs - (line 49)
    src/lib.rs - (line 8)
    src/lib.rs - (line 93)

test result: FAILED. 2 passed; 5 failed; 2 ignored; 0 measured; 0 filtered out; finished in 0.19s

error: test failed, to rerun pass '--doc'
error: in phase 'check': uncaught exception:
%exception #<&invoke-error program: "cargo" arguments: ("test" "--release") exit-status: 101 term-signal: #f stop-signal: #f>
phase `check' failed after 0.5 seconds
command "cargo" "test" "--release" failed with status 101
builder for `/gnu/store/4xzm4ingzgdzi8v006546c05w3wfbb5l-rust-dlib-0.5.0.drv' failed with exit code 1

Missing library path on OpenBSD

hi! thanks for dlib <3

i'm unable to build the following example code, stripped down from smithay-client-toolkit's ffi.rs, on OpenBSD:

dlib::external_library!(XkbCommon, "xkbcommon", functions:
    fn xkb_keysym_to_utf32(u32) -> u32,
);

fn main() {
    println!("hey, it compiled ;p\nlook, a u32! should be 0: {}",
        unsafe { xkb_keysym_to_utf32(1) }
    );
}

Cargo.toml only requires dlib:

[package]
name = "dlib-minimal-example"
version = "0.1.0"
edition = "2018"

[dependencies]
dlib = "0.5"

i see the error ld: error: unable to find library -lxkbcommon. using cargo run -v to print the rustc line and re-running that line with -L native=/usr/local/lib at the end results in a successful build. it builds without any intervention on my Arch Linux machine, where xkbcommon is installed to /usr/lib

how can i ensure that /usr/local/lib (the default path for libraries from installed ports/packages on OpenBSD) is included in the native library search path?

this error causes a failure when compiling iced, by way of smithay-client-toolkit, which is required by iced dependencies winit and window_clipboard

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.