Click here to Skip to main content
15,905,419 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a only DLL named key generator.DLL, i need to use this DLL to call below function. I copied this DLL into my project folder and it has automatically generated key generator.h and key generator.cpp.

uint securityKey = 0;
securityKey = Key_Generator.KeyCalculator.EOLP_CalculateKeyFromSeed(securitySeed);

Where Key_Generator is a namespace,
KeyCalculator is a static method inside the DLL and
securitySeed is a seed(uint type) you pass into the DLL

Note:My project template folder has example.h and example.cpp to generate a DLL in microsoft visual C++ 2010, which works without any error.

Question:
1. In which file i need to declare this import function? How?
2. Which files i need to include and where?
3. Do i need any library?
2. Any project setting?

Thanks,
Han
Posted

http://www.functionx.com/visualc/libraries/explicitdll.htm[^] works fine with MSVS , should help ya at least as an example ..
 
Share this answer
 
If you're statically linking against this DLL, then you need to include the .lib file in your linker settings. When you build you DLL, it will automatically produce a .lib file.

Alternatively, you can use LoadLibrary(), though that's not the way your example is usually handled.
 
Share this answer
 
Comments
Andrewpeter 24-Sep-12 1:04am    
I think this is ActiveX dll... so not use LoadLibrary() function.
JackDingler 24-Sep-12 8:58am    
You can dynamically load ActiveX DLLs, but there is a lot more pain involved...

Assume you have abc.dll only, and in your dll has a namespace TESTDLL and a Class named MyClass which has constructor as MyClass().
Now, in VC 2010 do:
- Click Properties on your project name -> Configuration Properties -> General -> set Common Language Runtime Support = Common Language Runtime Support(/clr) (recall: default is No) -> OK
- Click References on your project name -> Select Common Properties -> Add New References -> select Browser Tab -> select your abc.dll
- Now, you already use this dll.
- Next, in your code, to use class in the dll:
- using namespace TESTDLL
- declare the class from abc.dll
MyClass^ test;
test = gcnew MyClass();
// do something with the class

I test the dll which is created by C#.

Have fune!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900