VB Help / Upcoming 1.2.7 Release

  • David Salomon

    David Salomon - 2008-01-18

    I have tried, unsuccessfully, to use hamlib in VBA.  Here is what I've tried and the results:

    1.  Using the pre-compiled __stdcall 1.2.6 Win32 version -> a call to rig_init always returns a value of 0, even with the demo rig.  Therefore, I cannot do anything else.

    2.  Using the pre-compiled __cdecl 1.2.6 Win32 version -> I get a bad calling convention error (as expected).  I AM able to use this somewhat successfully using a tool from Paul Caton (http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=69718&lngWId=1).  The tool allows calling __cdecl calling convention DLLs from within VB.  However, it always passes and returns variables of type LONG.  While this works for setting comm parameters, init, and reading freqeuncy, it does NOT work for setting the frequency.  I haven't tried modifying his class library to see if I can make it work for type DOUBLE.

    3.  Compiling the current CVS source under MinGW in Win32 -> I get syntax errors.  It seems to be trying to include ioctl.h even though it's in Windows and should be trying to include winioctl.h.  I haven't dug into this to try to fix it.

    4.  Using the VB wrapper DLL done by Peter Carnegie, G8JCF for his SDR software (Norbert Schall pointed me to this).  This provides a working VB Wrapper for using the pre-compiled __cdecl version.  However, unfortunately, he didn't include calls for rig_token_lookup or rig_set_conf in his wrapper, so I cannot set the communication parameters needed to talk to the radio.  I asked him to add it, but got no reply (not a big surprise since he wrote the wrapper for a SDR radio that uses a USB interface, but it was worth a try :-).

    So, no matter what I've tried, I cannot get hamlib working completely in my VBA application.  The closest I've come is using the tool that allowed calls to __cdecl routines and used rigctl.exe to set the frequency, but thats a kludge that I'd rather not do if I can do it the "right" way.

    So, here are my questions/requests:

    1.  When 1.2.7 is complete (or before, if possible), can someone provide a working pre-compiled set of DLLs with a stdcall calling convention?  OR

    2.  Can someone tell me why the 1.2.6 pre-compiled stdcall version does not work?  Has anyone gotten it to work?

    Any help or suggestions would be greatly appreciated!!

    73 - KG4FJH, David

    • David Salomon

      David Salomon - 2008-01-27


      With help from Paul Caton, I am able to use the __cdecl version of the pre-compiled 1.2.6 Win32 DLLs.  THANKS PAUL!!  If anyone wants to use hamlib in VB and is having the same problems I had, contact me and I will provide info on how to use Paul's code to enable calling a __cdecl DLL from within VB.

      I would still prefer to use the __stdcall DLL to reduce overhead.  I am now able to compile cleanly under MinGW, and have changed the calling convention.  The results, however, are still the same as the pre-compiled 1.2.6 version provided by Stephane - rig_init always returns a value of 0.

      So, once again I ask for help - has anyone been successful with hamlib from VB?

    • Stéphane Fillod

      Hi David,

      I'm more a Linux guy, but I'd like to help you with the VB matter (I know almost nothing of VB, and I don't own this software at home).

      So how did you managed to pass DOUBLE values using the __cdecl VB wrapper? Would you mind sharing a demo program to be included with the Hamlib release for Windows ?

      I agree with you, it'd be so much better to make the __stdcall to work. If you have patches to share for compiling cleanly under MinGW, they are welcome. Maybe to help debugging the rig_init returning 0, have you tried calling rig_set_debug(5) beforehand to have some trace?
      A new binary of Hamlib 1.2.7 for Windows is about to be released. I do it in a cross-compiling fashion under Linux. I'll let you know when it's available.

      Rem: can you point me where the VB wrapper DLL done by Peter Carnegie, G8JCF can be found?

      Thanks for all your efforts on making Hamlib to work with VB.

      73 de F8CFE, Stéphane


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks