crypto module #59

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

Comments

Projects
None yet
3 participants

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.

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.

Contributor

russelldb commented Apr 19, 2012

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. "

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...

ibnfirnas added a commit to ibnfirnas/oauth1_core that referenced this issue Aug 23, 2014

@eproxus eproxus closed this in 98cdc40 Feb 2, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment