emily_hall
asked on
Trying to make a C# DLL that can be accessed from C++
My problem is that when I call it from C++, the CoInitialize() call gives me the error "Class not recognized"
I did some looking around and found some stuff that said i needed to make a strong name? So I did that using "sn -k myDLL.dll" and it said it was successful. Where do I go from here? If I look in WINNT\assembly I can see my library in a subfolder called Download. It is marked as private... Is that any help?
I did some looking around and found some stuff that said i needed to make a strong name? So I did that using "sn -k myDLL.dll" and it said it was successful. Where do I go from here? If I look in WINNT\assembly I can see my library in a subfolder called Download. It is marked as private... Is that any help?
To generate a keypair using sn:
sn -k StrongNamedDll.snk
A file with name StrongNamedDll.snk will be created in the current folder.
In the source code file assemblyinfo.cs add the following line:
[assembly: AssemblyKeyFile("StrongNam edDll.snk" )]
then compile the project and deploy it to GAC.
sn -k StrongNamedDll.snk
A file with name StrongNamedDll.snk will be created in the current folder.
In the source code file assemblyinfo.cs add the following line:
[assembly: AssemblyKeyFile("StrongNam
then compile the project and deploy it to GAC.
ASKER
like I said in my comment - I got it registered so that I am not getting that class not recognized error but now I am getting:
-------------------------- -
Microsoft Visual C++
-------------------------- -
Unhandled exception in TestProgram2.exe: 0xC0000005: Access Violation.
-------------------------- -
OK
-------------------------- -
When I try to call the funtion from C++.
--------------------------
Microsoft Visual C++
--------------------------
Unhandled exception in TestProgram2.exe: 0xC0000005: Access Violation.
--------------------------
OK
--------------------------
When I try to call the funtion from C++.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
--------------------------
Microsoft Visual C++
--------------------------
Unhandled exception in TestProgram2.exe: 0xC0000005: Access Violation.
--------------------------
OK
--------------------------
Any ideas?