From: bachegool on 4 Oct 2009 03:36 Hello, I have a regular DLL that uses MFC as static library, to use it I have exported one function from the dll. In the debug mode everything works correctly but in the release mode I get different errors. If I include the DLL headers at the top like this #include "../Grid/Grid.h" // dll #include "../Grid/GridHolderDLG.h"/dll #include <X11/StringDefs.h> #include <X11/Intrinsic.h> #include <Xm/Xm.h> #include <Xm/Text.h> #include <Xm/MessageB.h> #include "sdai/include/sdai_epm.h" #include "sdai/include/sdai.h" #include "format/include/format.h" #include "edms/include/unixwin.h" #include "edms/rc/resource.h" #include "edms/include/es_dbg.h" #include "edms/include/edms.h" #include "edms/include/es_aux.h" #include "edms/include/es_displ.h" #include "edms/include/es_data.h" #include "edms/include/es_selec.h" #include "edms/include/es_schem.h" #include "edms/include/es_comscr.h" I get these errors Compiling... es_wdisq.cpp C:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE\afxole.inl (97) : error C2065: 'vt' : undeclared identifier C:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE\afxole.inl (101) : error C2065: 'bVal' : undeclared identifier C:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE\afxole.inl (103) : error C2065: 'cyVal' : undeclared identifier C:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE\afxole.inl (103) : error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'const union tagCY' (or there is no acceptable conversion) C:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE\afxole.inl (105) : error C2065: 'fltVal' : undeclared identifier C:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE\afxole.inl (107) : error C2065: 'dblVal' : undeclared identifier C:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE\afxole.inl (109) : error C2065: 'date' : undeclared identifier C:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE\afxole.inl (283) : error C2065: 'parray' : undeclared identifier ...\edms/rc/resource.h(1389) : note C6311: C:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE\afxres.h(290) : see previous definition of 'IDC_STATIC' Error executing cl.exe. es_wdisq.cpp is the file with the above include files, but if I put the includes #include <X11/StringDefs.h> #include <X11/Intrinsic.h> #include <Xm/Xm.h> #include <Xm/Text.h> #include <Xm/MessageB.h> #include "../Grid/Grid.h" #include "../Grid/GridHolderDLG.h" #include "sdai/include/sdai_epm.h" #include "sdai/include/sdai.h" #include "format/include/format.h" #include "edms/include/unixwin.h" #include "edms/rc/resource.h" #include "edms/include/es_dbg.h" #include "edms/include/edms.h" #include "edms/include/es_aux.h" #include "edms/include/es_displ.h" #include "edms/include/es_data.h" #include "edms/include/es_selec.h" #include "edms/include/es_schem.h" #include "edms/include/es_comscr.h" I get Compiling... es_wdisq.cpp C:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE\afxv_w32.h (14) : fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h> Error executing cl.exe. so when using a mfc dll in a c\win32 application, what kind of arrangements should one have in regards to include files. ehsan
From: Giovanni Dicanio on 4 Oct 2009 04:27 "bachegool" <esadeghi48(a)gmail.com> ha scritto nel messaggio news:8edb3c90-f594-4298-8460-56d2ae34d61d(a)p9g2000vbl.googlegroups.com... > I have a regular DLL that uses MFC as static library, to use it I have > exported one function from the dll. So, if my understanding is correct, viewing from the outside, you have a DLL exposing a pure C interface (i.e. the one function you exported), is this correct? And you are using this DLL from a pure Win32 app? > If I include > the DLL headers at the top like this > #include "../Grid/Grid.h" // dll > #include "../Grid/GridHolderDLG.h"/dll What is the content of those DLL headers? Do MFC classes appear in those DLL headers? If so, it means that your DLL does *not* export a pure C interface (instead, it exposes a C++/MFC interface). > so when using a mfc dll in a c\win32 application, what kind of > arrangements should one have in regards to include files. Please clarify the type of your DLL. Is this a DLL with a pure C interface, or is it a DLL that exposes MFC classes? In the latter case, you can't use the DLL from a pure Win32 C app. Giovanni
From: bachegool on 5 Oct 2009 02:48 On Oct 4, 10:27 am, "Giovanni Dicanio" <giovanniDOTdica...(a)REMOVEMEgmail.com> wrote: > "bachegool" <esadegh...(a)gmail.com> ha scritto nel messaggionews:8edb3c90-f594-4298-8460-56d2ae34d61d(a)p9g2000vbl.googlegroups.com... > > > I have a regular DLL that uses MFC as static library, to use it I have > > exported one function from the dll. > > So, if my understanding is correct, viewing from the outside, you have a DLL > exposing a pure C interface (i.e. the one function you exported), is this > correct? > And you are using this DLL from a pure Win32 app? > > > If I include > > the DLL headers at the top like this > > #include "../Grid/Grid.h" // dll > > #include "../Grid/GridHolderDLG.h"/dll > > What is the content of those DLL headers? > Do MFC classes appear in those DLL headers? > If so, it means that your DLL does *not* export a pure C interface (instead, > it exposes a C++/MFC interface). > > > so when using a mfc dll in a c\win32 application, what kind of > > arrangements should one have in regards to include files. > > Please clarify the type of your DLL. > Is this a DLL with a pure C interface, or is it a DLL that exposes MFC > classes? > In the latter case, you can't use the DLL from a pure Win32 C app. > > Giovanni No, the include files belong to the whole MFC app which I have also included the function. but how can I export a pure C function from this dll?
From: bachegool on 5 Oct 2009 02:56 On Oct 5, 8:48 am, bachegool <esadegh...(a)gmail.com> wrote: > On Oct 4, 10:27 am, "Giovanni Dicanio" > > > > <giovanniDOTdica...(a)REMOVEMEgmail.com> wrote: > > "bachegool" <esadegh...(a)gmail.com> ha scritto nel messaggionews:8edb3c90-f594-4298-8460-56d2ae34d61d(a)p9g2000vbl.googlegroups.com... > > > > I have a regular DLL that uses MFC as static library, to use it I have > > > exported one function from the dll. > > > So, if my understanding is correct, viewing from the outside, you have a DLL > > exposing a pure C interface (i.e. the one function you exported), is this > > correct? > > And you are using this DLL from a pure Win32 app? > > > > If I include > > > the DLL headers at the top like this > > > #include "../Grid/Grid.h" // dll > > > #include "../Grid/GridHolderDLG.h"/dll > > > What is the content of those DLL headers? > > Do MFC classes appear in those DLL headers? > > If so, it means that your DLL does *not* export a pure C interface (instead, > > it exposes a C++/MFC interface). > > > > so when using a mfc dll in a c\win32 application, what kind of > > > arrangements should one have in regards to include files. > > > Please clarify the type of your DLL. > > Is this a DLL with a pure C interface, or is it a DLL that exposes MFC > > classes? > > In the latter case, you can't use the DLL from a pure Win32 C app. > > > Giovanni > > No, the include files belong to the whole MFC app which I have also > included the function. but how can I export a pure C function from > this dll? The function creates the GridHolderDLG class. so When you say "Is this a DLL with a pure C interface" are you talking about the signature or the function itself, the function in the DLL looks like this void showGrid(char *header, long numberOfRows, long numberOfColumns, char **columns, char **columnLabels, int columnPrimtypes[], int serverContextId) { AFX_MANAGE_STATE(AfxGetStaticModuleState()); gridArray[numberOfGrids] = new CGridHolderDLG(); ...... ehsan
From: Giovanni Dicanio on 5 Oct 2009 04:34 "bachegool" <esadeghi48(a)gmail.com> ha scritto nel messaggio news:1d8579e4-5b33-448f-98a3-3f793293b1ed(a)p15g2000vbl.googlegroups.com... > The function creates the GridHolderDLG class. so When you say "Is > this a DLL with a pure C interface" are you talking about the > signature or the function itself, the function in the DLL looks like > this > > void showGrid(char *header, > long numberOfRows, > long numberOfColumns, > char **columns, > char > **columnLabels, > int columnPrimtypes[], > int serverContextId) This function prototype is a perfect fit for a regular DLL with a pure C interface (in fact, for example, you don't have MFC classes or other C++ classes exposed from the function prototype). You just need an extern "C" to wrap the function prototype. You can use MFC inside your DLL implementation (and inside the function cited above), and the client of the DLL can be a pure C/C++ Win32 app, i.e. the client does not need to use MFC. I would suggest you to read this tutorial on CodeProject: http://www.codeproject.com/KB/DLL/RegDLL.aspx Giovanni
|
Next
|
Last
Pages: 1 2 Prev: Copying CByteArray to a CString? Next: Use Dialog instead Window in MFC Problem ! |