Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crypto module #59

Closed
madtrick opened this issue Mar 22, 2012 · 3 comments
Closed

crypto module #59

madtrick opened this issue Mar 22, 2012 · 3 comments
Labels

Comments

@madtrick
Copy link

Hi,

I'm trying to mock the crypto module just to check if it gets called but an error is raised instead.

This is the error output:

9> meck:new(crypto).               

=ERROR REPORT==== 22-Mar-2012::18:53:02 ===
Unable to load crypto library. Failed with error:
"bad_lib, Library module name 'crypto' does not match calling module 'crypto_meck_original'"
OpenSSL might not be installed on this system.

=ERROR REPORT==== 22-Mar-2012::18:53:02 ===
The on_load function for module crypto_meck_original returned {error,
                                                               {bad_lib,
                                                                "Library module name 'crypto' does not match calling module 'crypto_meck_original'"}}
** exception exit: {error_loading_module,crypto_meck_original,on_load_failure}

Mocking other modules works perfectly.

@eproxus
Copy link
Owner

eproxus commented Mar 28, 2012

Seems that the crypto library requires the Erlang module to be named crypto: https://github.com/erlang/otp/blob/master/lib/crypto/c_src/crypto.c#L279. I have no idea why that is. Meck will rename it to crypto_meck_original and thus it won't work. You might want to ask on the Erlang mailinglist why it has to be named like that.

@russelldb
Copy link
Contributor

Isn't this a NIF problem in general? "The first argument to ERL_NIF_INIT must be the name of the Erlang module as a C-identifier. "

@eproxus
Copy link
Owner

eproxus commented Apr 19, 2012

Possibly, I'm not that familiar with NIFs so I don't know. I think I've been able to mock NIFs before (although I haven't tried the crypto module) but I'm not sure...

xandkar added a commit to xandkar/oauth1_core that referenced this issue Aug 23, 2014
@eproxus eproxus closed this as completed in 98cdc40 Feb 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants