using external DLL in ATL COM object 
Author Message
 using external DLL in ATL COM object

I am new to VC++, and I am having a problem. I have a dll written in C whose
functionality I want to incorporate in my COM object. (The COM object was
created with ATL wizard.) I tried #include'ing the header file and
specifying the name of the dll in the project settings, but I get a link
error: LNK1136 which states that the file is invalid or corrupt, though it
was recently compiled with VC++. I know I must be doing something very wrong
on a basic level. Can someone help?

Thanks in advance,



Sat, 26 Jul 2003 08:57:46 GMT  
 using external DLL in ATL COM object
Greets,

    It sounds like your problem is that you are adding the ".DLL" file to
your project's link settings.  The dynamic link library is not like a static
library and you cannot do this.  Instead, you must supply an import library
to which your application will link.  This is typically created for you when
you do one of four things in a .DLL project:  a) use __declspec(dllexport)
to export symbols; b) use the /DEF option to the linker settings explicity;
c) use of the /DEF option in a #pragma to modify link settings; or c) create
.DEF file and add it to the source files in your project. I typically choose
the latter since it is easier to maintain as one unit, doesn't get lost in
the code or project settings and is useful for aliasing, forwarding
reference, providing non-named exports and eliminating all name mangling for
other languages that want to use the library.  Just add this .LIB file to
your client applications link settings for all builds and you should be
fine.

Regards,

Joe


Quote:
> I am new to VC++, and I am having a problem. I have a dll written in C
whose
> functionality I want to incorporate in my COM object. (The COM object was
> created with ATL wizard.) I tried #include'ing the header file and
> specifying the name of the dll in the project settings, but I get a link
> error: LNK1136 which states that the file is invalid or corrupt, though it
> was recently compiled with VC++. I know I must be doing something very
wrong
> on a basic level. Can someone help?

> Thanks in advance,



Sat, 26 Jul 2003 19:54:12 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Using AFX EXT DLL ATL objects in ATL EXE server

2. passing COM object pointers to another COM object in ATL

3. using external static libraries from an ATL DLL

4. Using a ATL Object in another ATL Object

5. Problem with scripting context when using VB com object inside VC com object

6. Using COM objects within COM objects

7. Using a ATL Object in another ATL Object

8. ATL COM - Passing ATL COM classes through another ATL COM class in the same app

9. Using COM objects from ATL?

10. Enumeratable COM-Object using ATL

11. Slightly off topic - Anyone used Netmeeting COM objects in ATL application

12. Use of MFC User DLL in ATL COM Object

 

 
Powered by phpBB® Forum Software