lua-users home
lua-l archive

Asynchronous callback

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


I have been working on a library and module to queue asynchronous messages and hit a problem that I cannot solve.
In cbModuleTest.lua the queue (a list, actually) in the cbq.lua file is populated and emptied by direct calls to the functions in cbq.lua - these work.
Here is that done interactively at the command prompt:
Lua 5.1.4 Copyright (C) 1994-2008 Lua.org, PUC-Rio
> require"cb"
> require"cbq"
>
> -- Direct Use
> cbCallback(12,13,14)
callback 12 13 14
table
1
table
12
13
14
> cbCallback(15,16,17)
callback 15 16 17
table
2
table
15
16
17
> print(pop())
pop 12 13 14
0 12 13 14
> print(pop())
pop 15 16 17
0 15 16 17
> print(pop())
1
Next, the same functions are used through the indirect means of the cb library. From the command window it can be seen that the callback is found and data is passed to it successfully. However, it fails when the table is declared and Lua is terminated.

> --Indirect Use
> cb.write(18,19,20)
callback 18 19 20
table
3
I am unable to understand how the execution can be different in the cbq.lua file depending on the means of calling a function. It is clear that the cbCallback function is executing, it just fails internally.
For those who may be interested, the attached zip file contains the cb.dll and the zip is password protected with 'eaton' as the password - a tribute to our email security that does not allow the attachment of executable files.
Thanks in advance for any suggestions.

Attachment: cbq.lua
Description: cbq.lua

Attachment: cbModuleTest.lua
Description: cbModuleTest.lua

Attachment: cb.cpp
Description: cb.cpp

Attachment: cb.def
Description: cb.def

Attachment: cb.zip
Description: cb.zip


AltStyle によって変換されたページ (->オリジナル) /