views:

698

answers:

4

Is it possible to use something like:

require 'serialport.o'

with Shoes? serialport.o is compiled c code as a ruby extension.

When I attempt to run the following code in shoes, I see no visible output to the screen and shoes crashes on OS X.

Thank you

CODE:

require "serialport.o"

port = "/dev/tty.usbserial-A1001O0o"

sp = SerialPort.new( port, 9600, 8, 1, SerialPort::NONE)

Shoes.app :width => 300, :height => 150, :margin => 10 do
  button "On" do
  sp.write( "1" )
  end
end

sp.close
+1  A: 

You've probably already checked this, but does the same thing work if you aren't using Shoes? For example:

require "serialport.o"

port = "/dev/tty.usbserial-A1001O0o"
sp = SerialPort.new( port, 9600, 8, 1, SerialPort::NONE)
sp.write( "1" )
sp.close
Moss Collum
A: 

I'm sorry. I should have mentioned that the code does work outside of Shoes :)

It seems to crash the shoes application if I simply include the line:

require 'serialport.o'

A: 

I had a similar problem, but it's with winxp.

Could you try like this?

Kernel::require "serialport.o"
DorianG
A: 

I've got the same problem in Windows 7. I have tried Kernel::require too, but it didn't work. Someone have found a solution?

Hugo Rosa