I am trying to write a wrapper functions around C.dll ( pbmman32.dll, if someone is familiar with it ) to use with c#.
Looking at the header files of the source, it doesn't seem that they implement __declspec(dllexport) although they do use extern "C"{}. Can i still call functions within that dll with the dllexport line missing?
For example:
BOOL PBM_Version (TCHAR* Buffer, WORD* Version, DWORD Size)
into:
[DllImport("pbmman32.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)]
public static extern bool PBM_Version(StringBuilder Buffer, StringBuilder Version, System.UInt32 Size);
The
__declspec(dllexport)is a convenient way to mark functions as exportable but it's not the only way (for instance they might have been exported using a .def file.You should be able to query a DLL to get all the exported functions (you could use something like http://www.dependencywalker.com/). If the one you want to call is exported then you're good to go.