[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.interop

How to link managed and unmanaged DLL ?

bakkalar

9/28/2007 11:41:00 PM

Hi all,

I have unmanaged C++ DLL that I need to link to managed C++ app. I
have set up a test CLR Console application that does nothing at this
point:

int main(array<System::String ^> ^args)
{
return 0;
}

When I added #include <unmanaged.h> at the top I have got the
following linker error:
"Error 38 error LNK2019: unresolved external symbol _main referenced
in function ___tmainCRTStartup LIBCMT.lib"

Then I replaced the funtion signature with "int main(int argc, char*
argv[])" and application successfully compiled but now I am getting
the following run-time error:
"An unhandled exception of type 'System.TypeInitializationException'
occurred in Unknown Module."

Is my unmanaged DLL uncompatible with managed environment or am I
missing some settings? Please, advise.

Thank you.