loadlib problems

View: New views
3 Messages — Rating Filter:   Alert me  

loadlib problems

by Aidan Gauland :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

  I'm want to write a plug-in for Pipmak, so I tried using the example plug-in
that comes with Pipmak, but I keep getting "attempt to call a nil value" when
I try this.  I've attached an example Pipmak project that shows exactly what
I'm doing, so if anyone can look at it and tell me what I'm doing wrong, that
would be great.  I'm running Debian etch GNU/Linux with Lua 5.0.

Thanks,
Aidan


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Pipmak-Users mailing list
Pipmak-Users@...
news://news.gmane.org/gmane.games.devel.pipmak.user
https://lists.sourceforge.net/lists/listinfo/pipmak-users

loadlibTest.pipmak (10K) Download Attachment

Re: loadlib problems

by Christian Walther :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Aidan Gauland wrote:
> I'm want to write a plug-in for Pipmak, so I tried using the example  
> plug-in that comes with Pipmak, but I keep getting "attempt to call  
> a nil value" when I try this.

>
> loadlib("hello.so", "init")()

loadlib() returns nil when it can't load the library. Check the second  
and third return values in that case, the second is an error message  
and the third "open" or "init" depending on whether the error was in  
opening the library or in finding the function.

I suspect that your error is "file not found" - the library will  
certainly not be found inside a zipped project, and even in an  
unzipped project, unless you changed the working directory to there,  
it won't be found inside the node if you just say "hello.so" without a  
path.

(As noted in commit message 188: "plugin support is quick-and-dirty  
for now, there is no standard way to locate plugins, and no formal API  
for plugins to interact with Pipmak". The former issue will be  
addressed in the real module support that I should be working on.)

   -Christian

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Pipmak-Users mailing list
Pipmak-Users@...
news://news.gmane.org/gmane.games.devel.pipmak.user
https://lists.sourceforge.net/lists/listinfo/pipmak-users

Re: loadlib problems

by Aidan Gauland :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Christian Walther wrote:
> I suspect that your error is "file not found" - the library will  
> certainly not be found inside a zipped project, and even in an  
> unzipped project, unless you changed the working directory to there,  
> it won't be found inside the node if you just say "hello.so" without a  
> path.

Ah, it finds it, if I give it the full path. It doesn't seem to like relative
paths (or, more likely, I can't figure out what the working directory is).

> (As noted in commit message 188: "plugin support is quick-and-dirty  
> for now, there is no standard way to locate plugins, and no formal API  
> for plugins to interact with Pipmak". The former issue will be  
> addressed in the real module support that I should be working on.)

I don't know if this could be done, but how about changing Pipmak to look for
plug-ins (when loadlib() is called, maybe write a wrapper function) in a
directory named "plugins" in the same
directory as the Pipmak project? (i.e. all plug-in paths are relative to the
"plugins" directory.)  So the directory structure might look like this...

loadlibTest/
|-- loadlibTest.pipmak
|   |-- 1
|   |   |-- face.png
|   |   `-- node.lua
|   `-- main.lua
`-- plugins
     `-- hello.so

  -Aidan



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Pipmak-Users mailing list
Pipmak-Users@...
news://news.gmane.org/gmane.games.devel.pipmak.user
https://lists.sourceforge.net/lists/listinfo/pipmak-users