how to know the dll export function's declare?
-
Since you posted in the C++/CLI forum, you implicitly admit your DLL was written in .NET. If you were lying and this DLL was not written in .NET then you have just posted in the wrong message board. Repost this question in the message board. Note that in .NET, CLR functions only have one calling convention, and that is __clrcall. The WINAPI or CDECL stuff only applies to native DLLs. If your function has uses WINAPI/CDECL, then your function is not written in .NET (see above). Also note that .NET DLLs do not export their CLR functions as dllexports. Instead, the functions are stored as Metadata, and are discovered using Reflection. The quick way to check the function signature is to add the DLL as a project reference (Project -> References -> Add New Reference -> Browse -> select your DLL -> OK OK). If this doesn't work, then your DLL is not a .NET DLL (see above). Now click on view Object Browser, and go down to the namespace of the DLL. This will show you all the function signatures in that DLL. How do you do this programmatically? The functions to use are given in System::Reflection. Once you have the System::Assembly of the DLL, call the Assembly::GetTypes method to get all the types of the assembly. Then you can call the GetMethods to get the methods in that Type (including private ones). To get the number and type of parameters, check out MethodInfo::GetParameters. That should allow you to discover the signature of the method.