Welcome to the new FlexRadio Community! Please review the new Community Rules and other important new Community information on the Message Board.
If you are having a problem, please check the Help Center for known solutions.
Need technical support from FlexRadio? It's as simple as Creating a HelpDesk ticket.

flexlib.dll x86 only? (v1.4.0)

rfoust
rfoust Member ✭✭
edited June 2020 in SmartSDR API
Trying to load the new flexlib.dll w/ v1.4 and i'm getting an error.  A quick google search seems to indicate the dll may have only been compiled with x86 support only, not x64.

If it was compiled with x64 support too, then maybe I'm doing something wrong. :-)  Here is the error (can be reproduced in powershell):

C:Program FilesFlexRadio SystemsSmartSDR v1.4.0> add-type -path $p
add-type : Could not load file or assembly 'file:///C:program filesFlexRadio SystemsSmartSDR v1.4.0flexlib.dll' or
one of its dependencies. An attempt was made to load a program with an incorrect format.
At line:1 char:1
+ add-type -path $p
+ ~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Add-Type], BadImageFormatException
    + FullyQualifiedErrorId : System.BadImageFormatException,Microsoft.PowerShell.Commands.AddTypeCommand

C:Program FilesFlexRadio SystemsSmartSDR v1.4.0>

Comments

  • rfoust
    rfoust Member ✭✭
    edited March 2017
    Figured out how to check for myself, it's x86 only. :-(  Any chance of getting a recompiled version? (edit: it should be MSIL which is what v1.3.8 is)

    (See link for reference): https://msdn.microsoft.com/library/system.reflection.processorarchitecture

    C:Program FilesFlexRadio SystemsSmartSDR v1.4.0> [reflection.assemblyname]::getassemblyname($p) | fl

    Name                  : FlexLib
    Version               : 1.4.0.28243
    CultureInfo           :
    CultureName           :
    CodeBase              : file:///C:/program files/FlexRadio Systems/SmartSDR v1.4.0/flexlib.dll
    EscapedCodeBase       : file:///C:/program%20files/FlexRadio%...
    ProcessorArchitecture : X86
    ContentType           : Default
    Flags                 : None
    HashAlgorithm         : SHA1
    VersionCompatibility  : SameMachine
    KeyPair               :
    FullName              : FlexLib, Version=1.4.0.28243, Culture=neutral, PublicKeyToken=null



    C:Program FilesFlexRadio SystemsSmartSDR v1.4.0>
  • Eric-KE5DTO
    Eric-KE5DTO Administrator, FlexRadio Employee admin
    edited June 2020
    What are you trying to load it in? You can indeed compile FlexLib as Any CPU (which supports both x86 and x64), but all of the libraries must be changed.
  • rfoust
    rfoust Member ✭✭
    edited December 2016
    Hi Eric - I use flixlib directly in powershell and load it using add-type (see above for an example).  Earlier versions of flexlib were compiled for any cpu so it worked fine until v1.4.  
  • rfoust
    rfoust Member ✭✭
    edited December 2016
    These are the actual functions I'm using to load it (lets see if the formatting works here):
    function get-flexlatestfolderpath  {  $flexRoot = "c:program filesFlexRadio Systems"   if (test-path $flexRoot)   {   $dirs = gci $flexRoot    if (-not $dirs)    {    throw "Unable to locate FlexRadio SmartSDR installation path!"    }    $modifiedDirs = @()    foreach ($dir in $dirs)    {    $rootName,$fullVersion,$null = $dir.name -split " "     if ($fullVersion)     {     $flexVersion = [version]($fullVersion -replace "v","")      $modifiedDir = $dir | add-member NoteProperty Version $flexVersion -passthru      $modifiedDirs += $modifiedDir     }    }    if ($modifiedDirs)    {    ($modifiedDirs | sort Version -desc)[0].fullname    }   }  }  function get-flexlibpath  {  $latestPath = get-flexlatestfolderpath   if ($latestPath)   {   $latestpath + "FlexLib.dll"   }  }  function import-flexlib  {  $flexLibPath = get-flexlibpath   if ($flexLibPath)   {   try    {    [void][reflection.assembly]::GetAssembly([flex.smoothlake.FlexLib.api])    }   catch [system.exception]    {    add-type -path $flexLibPath    }   }  else   {      throw "Unable to locate FlexRadio FlexLib library!"   }   [flex.smoothlake.FlexLib.api]::init()  }  import-flexlib
  • Peter K1PGV
    Peter K1PGV Member ✭✭
    edited December 2016
    KI4TTZ: Calling FlexLib directly from PowerShell is DARN clever.  Nice!

    Peter K1PGV
  • rfoust
    rfoust Member ✭✭
    edited December 2016
    Thanks! Yeah I've been working in a command line interface off and on for the last year, I need to finally get it cleaned up and posted to github after I get this new issue resolved.
  • rfoust
    rfoust Member ✭✭
    edited December 2016
    So I got flexlib compiled all by myself (yay, first time!) as "any cpu" and it seems to be working fine. So not sure if the one that came with ssdr 1.4 being compiled as x86 was just an oversight or if there was some reason for it?  

    I guess there aren't any licensing/legal issues with me including my own compiled version of flexlib.dll with my app?

    I think I'll add an additional check that uses the latest one in the ssdr folder, only if it is compatible with the host architecture. Otherwise, look for one in my custom app install folder and use that.  I dunno, I'm making this up as I go. :-)
  • Eric-KE5DTO
    Eric-KE5DTO Administrator, FlexRadio Employee admin
    edited December 2016
    Going to x86 was not an oversight.  In a .NET application, all of the libraries must agree on the architecture (x86, x64 or Any CPU which supports both).  It was intentional and required to cooperate with other libraries that were added to the application.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.