ITeye博客

修正Programming Erlang中linked driver实例的小问题

coderplay · 2007-10-08 14:50 · erlang · Markdown

也许很多人碰上过, 用example1_lid:start()会碰上如下错误:
     ** exited: {error,could_not_load_driver} **
    用gdb跟了一下, 发现其实load driver是没有问题, 问题出在load driver之后的版本匹配, driver_incorrect_version.

    解决办法很简单,两步:
  1. 把example1_lid.c中的
   #include "erl_driver.h" 改成
  #include <<erl_driver.h>erl_driver.h><erl_driver.h><erl_driver.h></erl_driver.h></erl_driver.h></erl_driver.h><erl_driver.h><erl_driver.h>
   2. 然后把Makefile中的
     gcc -o example1_drv.so -fpic -shared example1.c example1_lid.c
   这一行改成:
    gcc -I/usr/local/lib/erlang/usr/include -o example1_drv.so -fpic -shared example1.c example1_lid.c
   做完这两步就可以啦.
 
 make之后试试就没问题.</erl_driver.h></erl_driver.h><erl_driver.h><erl_driver.h></erl_driver.h></erl_driver.h>

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。