can someone help me solve my problem. I have a C++ program and i created a DLL out of it.
I have another C# forms application, and i added the DLL as 'add reference'. when i double click on this DLL, i get the 'Object Browser' and when i expand the '+' sign i don't see any of my member functions that i wrote in it.
example.h
#
1 2 3 4 5 6 7 8 9 10 11 12 13
pragma once
usingnamespace System;
namespace example {
public ref class Class1
{
public:
// TODO: Add your methods for this class here.
int main1(void);
};
}
If you created your Dll in unmanaged code, you can't add it as a reference. Add reference is just for Dlls written in managed code.
you can use DllImport attribute to import unmanaged dlls.
BTW, you should use __declspec(dllexport) before your function declaration and extern "c" around your function: