Reputation: 31
I have a DLL which is develeoped in VB.Net. I am trying to call its functions from my vc++ code. The dll has successfully loaded using LoadLibrary function. But when I try calling any function within the dll, it gives a null pointer exception.
I used the dumpbin command to confirm the function arguments within my dll. But it is not listing any functions. Could it be a problem with the dll or does dumpbin support few dlls only? Please help!
C:\Program Files (x86)\Microsoft Visual Studio 11.0>dumpbin ECR.dll Microsoft (R) COFF/PE Dumper Version 11.00.51106.1 Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file ECR.dll
File Type: DLL
Summary
2000 .reloc 4000 .rsrc 2000 .sdata 16000 .text
Upvotes: 3
Views: 2859
Reputation: 99
Try writing before any function in your DLL file (header .h files) the name of the project with _API at the end (ECR_API).
for example, lets say we want to create a constructor and destructor for a class called Loader:
class Loader{
public:
ECR_API Loader();
ECR_API ~Loader();
}
also dont forget to add export and import statements at the beggining of your header file:
#ifdef ECR_EXPORTS
#define ECR_API __declspec(dllexport)
#else
#define ECR __declspec(dllimport)
#endif
hope this helps! worked fine for me.
Upvotes: 0