From: Ralph Mason Date: 2002-01-31T14:34:56+09:00 Subject: Re: Win32API and dll programming in windows WARNING: I haven't used Win32api. But the function you are calling returns a float, and I assume that 'n' or number is a fixnum. So there is a datatype problem in the return. You want to give a return type of float Ralph ----- Original Message ----- From: "Raphael Clancy" Newsgroups: comp.lang.ruby To: "ruby-talk ML" ; Sent: Thursday, January 31, 2002 6:13 PM Subject: Win32API and dll programming in windows > Can anyone recomend a good reference on Win32API and dll programming in > general? I'm trying to get my head aroud it, but can't seem to make > things work. I decided to start out with a very simple function, which > had the signature: > > float GetDllVersion (); > > Looking at tha I can see that it doesn't want any arguments, and should > return a float. Knowing that I try to call it like so: > > dllVer = Win32API.new("NameOfDll", "GetDllVersion", [], 'n') > > I use [] for the import array 'cause I'm not passing anything to the > dll, and 'n'for the export because the function should return a number. > Then I call the function like so: > > vers = dllver.call() > puts "version: #{vers}" > > I run it, and get "version: 0", and I know from the documentation that > it should be version 1.03. the 0 makes me think that 'vers' never gets > anything put in it at all. Perhaps I'm missing the point of the import > array? should I be passing a 4 byte array to the dll, and letting it put > it's answer in that? did I forget to wave the dead chicken? > > I'm going to go beat on this some more, but any help would be > apreciated! > > Thanks, R. >