calling code with MFC in non MFC environment
-
I am developing a COM based exe that needs some already available functionality ( which exists in the form a static library using MFC ( MFC statically linked ) ). The API's exposed by the static library use primitive data types such as int , unsigned char etc . However when I include the static library in the COM project, it gives me a linker error about some CString's used . This is how the code is organized static library header file mystatic.h
int LibFunc1( int in, char *out) ;
static library source file mystatic.cppint LibFunc1( int in, char *out) { .. CString s = "Hello"; }
Com Component using static library#include "mystatic.h" .. .. LibFunc1(x, y)
I am wondering if there is a better way of re-using this as I dont want to rewrite the static library logic . Help is appreciated.Engineering is the effort !
-
I am developing a COM based exe that needs some already available functionality ( which exists in the form a static library using MFC ( MFC statically linked ) ). The API's exposed by the static library use primitive data types such as int , unsigned char etc . However when I include the static library in the COM project, it gives me a linker error about some CString's used . This is how the code is organized static library header file mystatic.h
int LibFunc1( int in, char *out) ;
static library source file mystatic.cppint LibFunc1( int in, char *out) { .. CString s = "Hello"; }
Com Component using static library#include "mystatic.h" .. .. LibFunc1(x, y)
I am wondering if there is a better way of re-using this as I dont want to rewrite the static library logic . Help is appreciated.Engineering is the effort !
What version of MFC is the library linked with? If CString is the only class you use, it's no longer part of MFC, and can be used without MFC. Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
What version of MFC is the library linked with? If CString is the only class you use, it's no longer part of MFC, and can be used without MFC. Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
What version of MFC is the library linked with? If CString is the only class you use, it's no longer part of MFC, and can be used without MFC. Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
I have stated CString as an eg however the static library uses other classes such as CStringArray , CArray etc
Engineering is the effort !
Cool. What are the exact linker errors? From the code you've shown, the COM module shouldn't know anything about a CString in the library code. Mark
Mark Salsbery Microsoft MVP - Visual C++ :java: