Message 1 of 2
Help. Error. Call unmanaged code in .net module
Not applicable
11-09-2017
09:11 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello! Sorry, my english is bad. I have a question:
1. I have .net dll module that starts of Autocad NETLOAD command.
2. In that module I have a unmanaged call in c++ dll.
3. Module start successfully. But when I click button which invoke unmanaged dll I have error - "0x8007000b An attempt was made to download a program that had an incorrect format"
4. I create exe application the same as dll module. This app works successfully and unmanaged module calls normally.
Please help me.
Code:
1) Call method in dll module on .NET
[return: MarshalAs(UnmanagedType.Struct)]
[DllImport("C:\\Users\\User\\Documents\\Visual Studio 2017\\Projects\\MyLibrary\\Debug\\MyLibrary.dll",CallingConvention = CallingConvention.Cdecl)]
public static extern ResultStructure UnmanagedFunction(double one, double two);
2) Signature function in c++
extern "C" __declspec(dllexport) ResultStructure UnmanagedFunction(double one, double two);
My config:
Windows 10
AutoCAD 2013
Visual Studio 2017
May be i have problem in target platform? But I tryed all ways. Please help me.