----- Original Message ----
> From: Aston <blackapache512-ticket / yahoo.com>
> To: Ruby Talk <ruby-talk / ruby-lang.org>; Ruby Core <ruby-core / ruby-lang.org>
> Sent: Fri, 2 July, 2010 9:07:00 PM
> Subject: [ruby-core:30996] Ruby/DL problem
> 
> Hello,
> 
> I have very littleexperience with dl. But I want to use it to 
> call SetEnvironmentVariable() from Win32. I could use FFI but cannot, since  
>this 
>
> script will be supplied to a customer where it is difficult to  install.
> 
> SetEnvironmentVariable on 
> MSDN http://msdn.microsoft.com/en-us/library/ms686206(v=VS.85).aspx
> 
> reading  sparse, old, and cryptic documentation I came up with this snippet, 
> which  of course does not work
> 
> require 'dl/import'
> 
> module Win32
> extend  DL::Importer
> extern "int SetEnvironmentVariableA( char* lpName, char*  lpValue)"
> extern "int GetEnvironmentVariableA( char* lpName, char* lpValue,  intsize)"
> end
> 
> buff = Array.new( 256,  0).pack("c*")
> Win32.GetEnvironmentVariableA( "ENV_VAR", buff, 255)
> puts  buff.unpack("a*")
> 
> this is the error i  get
> D:/ruby/usr/lib/ruby/1.9.1/dl/import.rb:194:in `import_function':  undefined 
> method `sym' for nil:NilClass(NoMethodError)
>          from D:/ruby/usr/lib/ruby/1.9.1/dl/import.rb:118:in  `extern'
>         from test.rb:5:in  `<module:Win32>'
>       from test.rb:3:in  `<main>'
> 
> machine is WinXP
> ruby 1.9.1 (2008-10-28 revision 19983)  [i386-mswin32_80]
> 
> can anybody suggest a better signature  ?
> 
> Aston
> 
> 


hmm, nobody here using Ruby.DL ?