in Search

visual c# 2008 MSFL

Last post 09-08-2009, 5:35 by ArmyofTheLostToys. 1 replies.
Sort Posts: Previous Next
  •  09-08-2009, 0:54 30626

    visual c# 2008 MSFL

    Hello People,

    I am struggling to call the MSFL APIs from c#... any help would be much appreciated... I have done the following:

    1. created a new class called MSFL and redefined all consts, enums and functions from the MSFL.h file. the functions redefined as follows:

    [DllImport("MSFL91.dll", CallingConvention = CallingConvention.StdCall)]
    public static extern int MSFL1_Initialize(string pszAppName, string pszUserName, int iInterfaceVersion);

    2. if i execute the following logic:

    int returnValue;
    string string1 = "programName";
    string string2 = "userName";
    returnValue = MSFL.MSFL1_Initialize(string1, string2, MSFL.MSFL_DLL_INTERFACE_VERSION);

    i get the following error:

    An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)

    System.BadImageFormatException was unhandled
      Message="An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)"
      Source="AotLT"
      StackTrace:
           at metastock.MSFL.MSFL1_Initialize(String pszAppName, String pszUserName, Int32 iInterfaceVersion)
           at AotLT.Program.Main(String[] args) in C:\Users\bundle\Documents\Visual Studio 2008\Projects\CSharp\AotLT\AotLT\Program.cs:line 97
           at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
           at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
           at System.Threading.ThreadHelper.ThreadStart()
      InnerException:

    thanks in advance.



  •  09-08-2009, 5:35 30627 in reply to 30626

    Re: visual c# 2008 MSFL

    for anyone that cares, i was building a console appl in windows7 64bit so by defauly my console appl was 64bit, forced this to 32bit and it worked fine. happy days.
View as RSS news feed in XML