lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Rename luaopen_libido to luaopen_foo

Write with HTC g7.

在 2011-2-22 上午12:37,"jseb" <gmane2010@finiderire.com>编写:

I did a try with Visual C++ (express edition, the one you get for free on microsoft website)

Here is my compilation on command line:

set incpath=%vcinstalldir%\include
set libpath=%vcinstalldir%\lib
cl foo.cpp -c /I%incpath%\lua
link -dll foo.obj lua51.lib

And i get "foo.dll", of course.
When i try require "foo" in lua, i still get :

> require "foo"
error loading module 'foo' from file '.\foo.dll':
       La procÚdure spécifiée est introuvable.

(same as my previous try with g++)


Here is the source-file.
Are there any windows user who could help me, and explain how to compile it, whatever toolchain you use (Visual C, mingw ...).
Thank you!

I rewrite the source file, now it's very simple. It still works without problems in Linux.



extern "C" {


#include <stdio.h>
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>

static int lua_print(lua_State*);
__declspec(dllexport)
int luaopen_libfoo(lua_State*);


}

static int lua_print(lua_State *L)
{
  printf ("called: lua_print\n");
  return 0;
}

static con...

__declspec(dllexport)
int luaopen_libfoo(lua_State *L)

{
 luaL_register (L, "foo", foo_fx);
 return 1;
}