Saturday, 15 January 2011

How to import a managed c++ library to C# app (target .net version 3.5) -



How to import a managed c++ library to C# app (target .net version 3.5) -

i created managed c++ library (wrapper) in visual studio uses non-managed c++ library. wrapped used c# application uses .net framework 3.5.

in c++ add together additional dependecies linker , re-create .lib files , .h files of external library folder source files exists. setup 32bit platform , release configuration , build solution. dll created reference in c# application's configuration.

everything ok when utilize illustration .net 4.5 in c# , c++, c# must using 3.5 version. read need build c++ library in older visual studio (i tried 2005 , 2008). setted v90 build tools , 3.5 .net version , built dll.

when build c# project no errors shown, after running got such error:

i checked dependecies of library , result (i wrote version next every item, of them 4.0.0.0, 2.0.0.0). i'm struggling few hours , have no thought how create working..

the exception class, filenotfoundexception, little misleading. error code (0x8007007e) says more. that's com error code represents win32 error code.

how can tell that? well, structure of com error codes described on msdn. 8 indicates error, , 7 facility, facility_win32. so, com error code of form 0x8007xxxx win32 error code. win32 error code wrapped found in to the lowest degree important word. here 0x007e error_mod_not_found. associated text is:

the specified module not found.

that error occurs when scheme attempts load unmanaged dll , cannot locate it. managed assembly appear depend upon unmanaged dlls, , @ to the lowest degree 1 of them cannot found. commonly that:

the main unmanaged dll managed assembly wraps cannot found, or, the msvc runtime unmanaged dll requires cannot found.

you'll need dig little deeper in documentation managed assembly work out problem is. points in right direction. , hope i've given pointers how decode error codes in future.

c# c++ visual-studio

No comments:

Post a Comment