How to use a DLL without the need for .h and .lib files in a VC ++ 6.0 project?

I do not know how to do the following:

  • I am using MS Visual C ++ 6.0
  • I have a Win32 DLL project that compiles.
  • I have another project, this time a Win32 Console project that uses a DLL by including its header file and linking the .lib DLL file.

Now I want to have another project that looks like a second BUT without using a header file and a lib file.

Is it possible? Wherever I read, you need either dll + lib + h or dll + h. If you think you know the interfaces, is the dll file enough?

Btw, using "using DLLs", I mean, using classes and functions defined in DLLs.

+4
source share
2 answers

Perhaps if you have simple extern C functions. If so, then the approach can be loaded by the dll using LoadLibrary , and then import each function using GetProcAddress , of course, you need to know the signature of the function to create the correctly declared function pointer. Using classes to the opposite is almost impossible.

+4
source

If your DLL contains classes, there is a good chance that it is a COM component.

If so, the #import directive (which you use as #include) creates some temporary include files containing interface details. You must use COM to access your objects.

Otherwise, if you have a "simple" DLL with C ++ classes, you can access the exported symbols using the linker: give the command to discard the map (see here ) to know the changed names. But I do not think that you can manually create an interface ...

0
source

Source: https://habr.com/ru/post/1387229/


All Articles