Forum: Ruby Newbie Question: Ruby/DL Parameters

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
6ed929f66af5a2a5da2f72552bb8b789?d=identicon&s=25 Chris Wiles (chrisw)
on 2007-03-11 00:06
Hello,

I am trying to call a function within a WIN32 DLL.


The Function Prototype is published as:
  short pm3s(char* name, unsigned short addr, unsigned short* units);


I coded this:

  module Discover
    extend DL::Importable
    dlload "RPPM3DDI.DLL"
    extern "short pm3s(char*, unsigned short, unsigned short*)"
  end

  s = "Monitor 3"
  unit = 0
  count = 0

  res = Discover.pm3s(s, unit, count)


When executed, I get:

(eval):5: [BUG] Segmentation fault
ruby 1.8.5 (2006-12-25) [i386-mswin32]

I assume that I am not specifying the parameters correctly.  Any ideas
or comments will be appreciated.

Thanks.
This topic is locked and can not be replied to.