<div class="gmail_quote"><div class="HOEnZb"><div class="h5">On 7 May 2013 12:00, 韦崇焜 <span dir="ltr"><<a href="mailto:wckbluesky@yahoo.com.cn" target="_blank">wckbluesky@yahoo.com.cn</a>></span> wrote:<br></div></div>
<div class="gmail_quote"><div><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
hi<br>
<br>
I am testing nif in windows right now, the nif c code is very simple and it is copyed directly from <a href="http://www.erlang.org/doc/tutorial/nif.html#id64988" target="_blank">http://www.erlang.org/doc/tutorial/nif.html#id64988</a><br>


<br>
All the code is running well in Linux, and c code is compiled to .so in linux, .dll in windows<br>
<br>
Everything is ok before I running "c(complex6)" in erlang VM, in windows,<br>
<br>
it reports<br>
<br>
=ERROR REPORT==== 7-May-2013::17:36:19 ===<br>
Error in process <0.70.0> with exit value: {{badmatch,{error,{load_failed,"Faile<br>
d to load NIF library ./complex6_nif: 'Unspecified error'"}}},[{complex6,init,0,<br>
[{file,"complex6.erl"},{line,7}]},{code_server,'-handle_on_load/4-fun-0-',1,[{fi<br>
le,"code_server.erl"},...<br>
<br>
<br>
=ERROR REPORT==== 7-May-2013::17:36:19 ===<br>
The on_load function for module complex6 returned {{badmatch,<br>
                                                    {error,<br>
                                                     {load_failed,<br>
                                                      "Failed to load NIF library ./complex6_nif: 'Unspecified error'"}}},<br>
                                                   [{complex6,init,0,<br>
                                                     [{file,...},{...}]},<br>
                                                    {code_server,<br>
                                                     '-handle_on_load/4-fun-0-',<br>
                                                     1,<br>
                                                     [{...}|...]}]}<br>
{error,on_load_failure}<br>
<br>
It is hard to find some useful information in google.<br>
Can anyone tell how to fix it?<br><br></blockquote><div><br></div></div></div><div>Hi ckwei,</div><div><br></div><div>It might be useful to paste some of the source code that isn't working for you. I don't have windows handy, but here's a NIF example that works on both Windows using command shell and SDK 7.1,  and LInux, that Volker & I did last year. The erlang side NIF loader was poached from one of Paul Davis' projects IIRC.</div>

<div><br></div><div><a href="https://github.com/vmx/hellonif" target="_blank">https://github.com/vmx/hellonif</a></div><div><br></div><div>A+</div><span class="HOEnZb"><font color="#888888"><div>Dave</div><div> </div></font></span></div>
<br>
</div><br>