Transfer data members from .exe to .dll 
Author Message
 Transfer data members from .exe to .dll

Hi,

I have an application with numerous data members.

I have to write a DLL to do all the calculations required by my
application.

How can I have access to the data members from the CMyClassView.cpp in
the DLL implementation ?  I want to have access by another method than
as arguments pass in a function.

                        Thanks for any help.

                        Claude Gagnon



Sat, 11 Mar 2000 03:00:00 GMT  
 Transfer data members from .exe to .dll

 Claude,

Create a var structure based upon the information you wish to transfer. Make
sure that both programs have #include'd the header file describing the
structure. Pass a pointer to the structure into your .DLL exported function.
Recommended: do not use C++ style vars (i.e. CString, COleDateTime, etc)
except as Read Only within the .DLL. Best to stick to standard C styles such
as BYTE, CHAR, WCHAR, int, long, short, etc.

Quick example:

/* the structure from a common header file*/
typedef struct tagMYINFO
{
    char mystring[UNLEN];
    int mynumber;
    DWORD mysysdate;

Quote:
}MYINFO, *PMYINFO, FAR *LPMYINFO;

/* the EXE function */
void MyExeFunc(void)
{
 LPMYINFO lpMyInfo = new MYINFO;

 strcpy(lpMyInfo->mystring, "This is my string");
 lpMyInfo->mynumber = 128;
 lpMyInfo->mysysdate = 10000001;

 MyDllFunc(lpMyInfo);

 return;

Quote:
}

/* the DLL function */
void WINAPI MyDllFunc(LPMYINFO lpMyOwnInfo)
{
char Mssg[UNLEN + 64];  // big enough to handle 'mystring' and some for the
others

sprintf(Mssg, "%s\nMy number is %d\nMy numerical sys date is %lu",
lpMyOwnInfo->mystring, lpMyOwnInfo->mynumber, lpMyOwnInfo->mysysdate);

MessagerBox(Getfocus(), Mssg, "My values", MB_OK|MB_ICONINFORMATION);

return;

Quote:
}

Hmmm... I think I got those right. Remember to export the function in the
DLL, include the LIB file, and use the C wrapper in the import/export
declarations.

Dennis Pugh


Quote:

>Hi,

>I have an application with numerous data members.

>I have to write a DLL to do all the calculations required by my
>application.

>How can I have access to the data members from the CMyClassView.cpp in
>the DLL implementation ?  I want to have access by another method than
>as arguments pass in a function.

> Thanks for any help.

> Claude Gagnon



Sat, 11 Mar 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Transferring Data between DLL's and Applications

2. How do I export MFC classes from .exe, and call members from a Dll

3. Exporting static data members in DLL problem

4. Exporting static data members to a DLL.

5. Exporting class static data member from DLL( long )

6. Resolving static data members in DLLs

7. Accessing STL data members in DLLs

8. Unresolved static template data member exported from DLL

9. Accessing STL data members in DLL

10. DLLs: exported static data members...

11. Passing Data Between Exe's using Dll

12. Location of const data in an exe or dll

 

 
Powered by phpBB® Forum Software