Grasshopper

algorithmic modeling for Rhino

I've created a GH component that call a method in an unmanaged 32 bits dll :

[System.Security.SuppressUnmanagedCodeSecurity]

[DllImport("MetaCalc.dll")]

public static extern unsafe void CalculateVertexValues(...);

 

When I run the component in Grasshopper I have a message "trying to load a program with incorrect format" (HRESULT = 0x8007000B).

In Visual Studio 2010 project build is set to x86 only, so I don't think it's a 32/64 bits problem (I use Grasshopper 0.9.0014 with Rhino 5.0 beta x64 on Windows 7)

I tried to use the same method in a C# executable, it runs flawlessly...

 

Thanks in advance for your help !

Views: 589

Replies to This Discussion

Some news...

My component runs fine with Rhino 4.0 SR 9, so it seems that Grasshopper 0.9.0014 is compiled for both x86 and x64 but a 32 bits component can't call a 32 bits unmanaged dll in Rhino 5.0 x64.

I can't recompile my dll to x64, is there some code option in C# to define that you want to call a 32 bits method ?

Hi Olivier,

The operating system won't let you call native 32bit DLLs from a 64bit process.  You need to either figure out how to compile your DLL to 64bit or run the 32bit version of Rhino 5.

-Steve

Thanks Steve, that's what I thought... I can't recompile my dll because I don't have the source code, so I will run my component with the 32 bits version.

RSS

About

Translate

Search

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service