C
C#2mo ago
Dendix

Attempt to run a program with dll

I'm running this from vscode. The full error is:
c:\\Users\\Admin\\.vscode\\extensions\\ms-dotnettools.csharp-2.50.25-win32-x64\\.debugger\\x86_64\\vsdbg.exe --interpreter=vscode --connection=e8ed18252661403681b3640aca80dbff
Unhandled exception. System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (0x8007000B)
at Naquadic.Miniaudio.Windows.avx2.ma_engine_init(ma_engine_config* pConfig, ma_engine* pEngine)
at Program.Main(String[] args) in C:\Users\Admin\Documents\miniaudio\Test\Program.cs:line 13
c:\\Users\\Admin\\.vscode\\extensions\\ms-dotnettools.csharp-2.50.25-win32-x64\\.debugger\\x86_64\\vsdbg.exe --interpreter=vscode --connection=e8ed18252661403681b3640aca80dbff
Unhandled exception. System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (0x8007000B)
at Naquadic.Miniaudio.Windows.avx2.ma_engine_init(ma_engine_config* pConfig, ma_engine* pEngine)
at Program.Main(String[] args) in C:\Users\Admin\Documents\miniaudio\Test\Program.cs:line 13
And the console project Main file:
using Naquadic;
using Naquadic.Miniaudio.Windows;

class Program
{
static void Main(string[] args)
{
unsafe
{
ma_result result;
ma_engine engine;

result = avx2.ma_engine_init(null, &engine);
if (result != ma_result.MA_SUCCESS)
{
Console.WriteLine(result);
}
}
}
}
using Naquadic;
using Naquadic.Miniaudio.Windows;

class Program
{
static void Main(string[] args)
{
unsafe
{
ma_result result;
ma_engine engine;

result = avx2.ma_engine_init(null, &engine);
if (result != ma_result.MA_SUCCESS)
{
Console.WriteLine(result);
}
}
}
}
Naquadic is a reference to another project which exposes miniaudio structs, funcs, etc. I look up this error and it seems that the project and the dll is compiled in different architectures? Though I have no idea how to fix it since when I run it by clicking the little play icon at the top right, the command it uses to build always include /p:Platform="AnyCPU" and i don't know how to configure that. Any help is obv very much appreciated
7 Replies
Omnissiah
Omnissiah2mo ago
you can look at the build architecture of said dll (you can use ilspy, exe explorer, whatever) if it's just 32 bit you can use build->configuration manager and create a build for just that
Dendix
DendixOP2mo ago
to be extra sure i put -m64 into gcc when building so it should be x64. and i kinda not want anything to do with 32 bit also im running on vscode so afaik theres no config man
Omnissiah
Omnissiah2mo ago
in the project there are sections for the build one for just x64 should have the element <PlatformTarget>x64</PlatformTarget> but i don't know how to do it with vscode maybe you can search that PropertyGroup somewhere and copy it
Dendix
DendixOP2mo ago
ill try tgat thanks
Dendix
DendixOP2mo ago
nothing works... interesting to see the var still gets assigned tho
No description
Unknown User
Unknown User2mo ago
Message Not Public
Sign In & Join Server To View
Dendix
DendixOP2mo ago
GitHub
GitHub - RKevo/naquadic
Contribute to RKevo/naquadic development by creating an account on GitHub.
Want results from more Discord servers?
Add your server