Help. Error. Call unmanaged code in .net module

Help. Error. Call unmanaged code in .net module

Anonymous
Not applicable
415 Views
1 Reply
Message 1 of 2

Help. Error. Call unmanaged code in .net module

Anonymous
Not applicable

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.







 

0 Likes
416 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable

 Thank's All! Sorry I solve the problem of! I needed rebuild unmanaged dll on x64 version. I do this but I don't rewrite static path in method attribute in my .net module=) 

0 Likes