Is there any good example cmod module which I could take as a starting point for creating a new one? Preferably with linking to some externaly shared library.
I've tried using the "hello.tgz" module which is on the website but it won't compile using the latest pike 7.8.435: In file included from hello.cmod:8: /usr/local/pike/7.8.435/include/pike/module_magic.h:25:2: error: #error module_magic.h is deprecated. Please read the header file for details. hello.cmod:25: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘struct’ hello.cmod:30: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ptrdiff_t’ hello.cmod:31: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’ hello.cmod:45: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ptrdiff_t’ hello.cmod:46: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’ hello.cmod:58: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token hello.cmod:26: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token WARNING: Compiler failure! Trying without optimization! In file included from hello.cmod:8:
/Marc
Marc Dirix wrote:
Is there any good example cmod module which I could take as a starting point for creating a new one? Preferably with linking to some externaly shared library.
Look in the existing Pike tree under src/modules for suitable "templates". Cmod with external lib: src/modules/_Regexp_PCRE might do as an example.
You can find a "sample module" in my source repository. It's got everything you need to create a working module. Just fill in the blanks. There are also some useful sample modules located in the source repository.
http://hg.welliver.org/pike_modules/
Enjoy!
Bill
On Thu, 27 May 2010, Marc Dirix wrote:
Is there any good example cmod module which I could take as a starting point for creating a new one? Preferably with linking to some externaly shared library.
I've tried using the "hello.tgz" module which is on the website but it won't compile using the latest pike 7.8.435: In file included from hello.cmod:8: /usr/local/pike/7.8.435/include/pike/module_magic.h:25:2: error: #error module_magic.h is deprecated. Please read the header file for details. hello.cmod:25: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘struct’ hello.cmod:30: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ptrdiff_t’ hello.cmod:31: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’ hello.cmod:45: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ptrdiff_t’ hello.cmod:46: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’ hello.cmod:58: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token hello.cmod:26: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token WARNING: Compiler failure! Trying without optimization! In file included from hello.cmod:8:
/Marc
On 27-05-10 17:36, Bill Welliver wrote:
You can find a "sample module" in my source repository. It's got everything you need to create a working module. Just fill in the blanks. There are also some useful sample modules located in the source repository.
It seems there is something wrong with the sample. If I compile and install it. I get this output:
object a = Public.Sample();
Cannot call undefined lfun `().
Seems it can't call create.
Any thoughts?
/Marc
I haven't lood at the sample, but it's likely that you're trying to call `()() on the module object itself, rather than on a class called Public.Sample. I don't recall whether I defined a pike class within that module or not, but if I did, it would probably be Public.Sample.Sample.
Bill
On Fri, 28 May 2010, Marc Dirix wrote:
On 27-05-10 17:36, Bill Welliver wrote:
You can find a "sample module" in my source repository. It's got everything you need to create a working module. Just fill in the blanks. There are also some useful sample modules located in the source repository.
It seems there is something wrong with the sample. If I compile and install it. I get this output:
object a = Public.Sample();
Cannot call undefined lfun `().
Seems it can't call create.
Any thoughts?
/Marc
Yep, just took a look, and while there's a definition of create() in the cmod file, it's implicitly called as part of the instantiation process of the module (remember that a cmod is equivalent to a pmod file rather than a .pike file). There is an empty class called "foo", so you'd do:
Public.Sample.foo();
Hope this clarifies the situation a bit.
Bill
On Fri, 28 May 2010, Marc Dirix wrote:
On 27-05-10 17:36, Bill Welliver wrote:
You can find a "sample module" in my source repository. It's got everything you need to create a working module. Just fill in the blanks. There are also some useful sample modules located in the source repository.
It seems there is something wrong with the sample. If I compile and install it. I get this output:
object a = Public.Sample();
Cannot call undefined lfun `().
Seems it can't call create.
Any thoughts?
/Marc
I wanted to send it to here:
From: linuxlinux1@windowslive.com To: marc@electronics-design.nl Subject: RE: cmod example Date: Mon, 31 May 2010 22:39:29 +0200
Hi, I wrote such module. It isn't a very expert example, but is good for trying out. Sorry, but I didn't have time to translate some parts to english, however it's still understandable...
You can compile it on linux by using the build.sh script. You need to take a look at the path of pike before doing it. I think I used a different version of pike and built from source.
Cheers: Tamás
Date: Thu, 27 May 2010 13:42:11 +0200 From: marc@electronics-design.nl To: pike-devel@lists.lysator.liu.se Subject: cmod example
Is there any good example cmod module which I could take as a starting point for creating a new one? Preferably with linking to some externaly shared library.
I've tried using the "hello.tgz" module which is on the website but it won't compile using the latest pike 7.8.435: In file included from hello.cmod:8: /usr/local/pike/7.8.435/include/pike/module_magic.h:25:2: error: #error module_magic.h is deprecated. Please read the header file for details. hello.cmod:25: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘struct’ hello.cmod:30: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ptrdiff_t’ hello.cmod:31: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’ hello.cmod:45: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ptrdiff_t’ hello.cmod:46: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’ hello.cmod:58: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token hello.cmod:26: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token WARNING: Compiler failure! Trying without optimization! In file included from hello.cmod:8:
/Marc
Menet közben használható e-mail és egyéb funkciók. Töltse le ingyen a Windows Live Hotmail programot. Regisztráljon most! _________________________________________________________________ Hotmail: Ingyenes, megbízható és sokoldalú e-mail szolgáltatás. https://signup.live.com/signup.aspx?id=60969
pike-devel@lists.lysator.liu.se