[code] Shared objects

From: Verbitsky Anton <averbitski.att.yandex.ua>
Date: Mon, 02 Apr 2012 18:16:05 +0400

Hi all,

three days ago I finally updated Arch on my laptop
and my rather old (3.9) version of TA ceased to function.
So, I updated the last (5.2) version and started to customize
it to the new interfaces.
Here's where I need some help from smarter folks like you ;)

I want to use the lua binding for Hunspell from Michal Kottman
In the old interpreter it works just fine (spell.so in the current directory)
  [anton@~/.textadept/modules/anton/spellchecker]% lua
  Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio
> spell = require 'spell'
> print(spell)
  function: 0x1b23290
> spellchecker = spell("/usr/share/myspell/en_US.aff",
    "/usr/share/myspell/en_US.dic")
> print(spellchecker:spell("cumbersome"))
  true
> print(spellchecker:spell("cumbersame"))
  false

The new version (default settings from AUR) gives me this
  [anton@~/.textadept/modules/anton/spellchecker]% lua5.2
  Lua 5.2.0 Copyright (C) 1994-2011 Lua.org, PUC-Rio
> spell = require 'spell'
  error loading module 'spell' from file './spell.so':
          dynamic libraries not enabled; check your Lua installation
  stack traceback:
          [C]: in ?
          [C]: in function 'require'
          stdin:1: in main chunk
          [C]: in ?

If I try to invoke this shared library from TextAdept
-- .textadept/init.lua
  package.path = table.concat({
    _USERHOME..'/modules/anton/spellchecker/init.lua',
    package.path
  }, ';');

  package.cpath = table.concat({
    _USERHOME..'/modules/anton/spellchecker/spell.so',
    package.cpath
  }, ';');

  local M = {}
  _M.textadept = M

  -- other modules
  M.spellchecker = require 'anton.spellchecker'
  M.keys = require 'textadept.keys'
  M.menu = require 'textadept.menu'
  return M

-- in /anton/spellchecker/init.lua
  local M = {}
  M.spell = require 'spell'
  return M

I get
error loading module 'spell' from file '/home/anton/.textadept/modules/anton/spellchecker/init.lua':
        /home/anton/.textadept/modules/anton/spellchecker/init.lua:1: too many C levels (limit is 200) in main function near '{'

Where's the problem:
1. There was some change in the binding interface, and I need to
modify the binding *.cpp file and recompile everything against Lua 5.2.
and then everything will be ok.
2. I need to modify something in TextAdept to be able to load shared objects.

Best regards and thanks in advance,
anton

P.S.: And congratulations Mitchell. The version number of TA is now equal to
the version number of Lua!

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Mon 02 Apr 2012 - 10:16:05 EDT

This archive was generated by hypermail 2.2.0 : Tue 03 Apr 2012 - 06:34:51 EDT