title: Loading a C Module in Lua
body: <p>I am trying to load the example lproc program (described on Programming Lua, Chapter 30) into Lua and fouling up somehow. I am following this - <a href="http://www.lua.org/pil/26.2.html" rel="noreferrer">http://www.lua.org/pil/26.2.html</a> to get my c module into lua. Following are the steps that I've taken:</p>
  
  <ol>
  <li><p>I have an lproc.h and lproc.c (containing exactly the functions laid out in Chapter 30 of the book). I am compiling lproc.c as --- gcc -c lproc.c -DLUA-USERCONFIG=\"lproc.h\" </p></li>
  <li><p>I made a library out of lproc.o, named the same.</p></li>
  <li><p>And then compiled lua.c as instructed. My header files contain the macro LUA_EXTRALIBS and the method declarations.</p></li>
  <li><p>Went to the Lua interpreter and it gave the following errors:</p></li>
  </ol>
  
  <pre>
  > require "lproc"
  stdin:1: module 'lproc' not found:
      no field package.preload['lproc']
      no file './lproc.lua'
      no file '/opt/local/share/lua/5.1/lproc.lua'
      no file '/opt/local/share/lua/5.1/lproc/init.lua'
      no file '/opt/local/lib/lua/5.1/lproc.lua'
      no file '/opt/local/lib/lua/5.1/lproc/init.lua'
      no file './lproc.so'
      no file '/opt/local/lib/lua/5.1/lproc.so'
      no file '/opt/local/lib/lua/5.1/loadall.so'
  stack traceback:
      [C]: in function 'require'
      stdin:1: in main chunk
      [C]: ?
  </pre>
  
  <p>It seems that the module did not get registered, what would I need to do from Lua? Time is short and I am doing something horrendously wrong, any direction would be welcome.</p>
  
  <p>Thanks,<br>
  Sayan</p>