Click here to Skip to main content
15,175,525 members

Comments by Praveen Kumar Katiyar (Top 5 by date)

Praveen Kumar Katiyar 13-Dec-19 3:28am View
   
#ifdef BUILD_MY_DLL // this is defined in the DLL's project ONLY!!!

first line is not available in my (DLL's Project) header file. then I checked it, and it was defined (DLL's Project) in the Project Settings

Project Properties -> Configuration Properties -> C/C++ -> Prepreprocessor ->Prepreprocessor Definitions. (I am using VS2010 Ultimate).
Praveen Kumar Katiyar 12-Dec-19 9:37am View
   
I did a full rebuild of all the targets. and copied the updated dll in the exe's folder, but no avail.
Praveen Kumar Katiyar 12-Dec-19 7:02am View
   
Deleted
Here is some Header file let say 'MyDLLImports.h' which contains.

typedef struct _tagMYPERSON
{
WCHAR FName[MAX_NAME_LENGTH];
WCHAR LName[MAX_NAME_LENGTH];
int Age;
double Salary;
}MYPERSON;

extern "C" MARSHALDLL_API void __cdecl ModifyPersonStructArray(int nCount, MYPERSON* pPersonArr);

Now i include this in my Dialog class (where i need to call this). like below.

#include "MyDLLImports.h"

void CMFCClientDlg::OnBnClickedPersonArr()
{
// TODO: Add your control notification handler code here
int nCount = 4;
MYPERSON* prsnArr = new MYPERSON[nCount];
CString strTmp;

m_lstOutput.ResetContent ();
m_lstOutput.AddString(_T("Before Call ==>"));
for (int nI=0; nI<ncount ;="" ni++)
="" {
="" strtmp.format(_t("first="" name="" %d"),="" ni+1);
="" stringcchcopyw(prsnarr[ni].fname,="" max_name_length,="" strtmp);
="" strtmp.format(_t("last="" stringcchcopyw(prsnarr[ni].lname,="" prsnarr="" [ni].age="20" +="" (ni+="" 1)*2="" ;
="" [ni].salary="20000" 1)="" *="" 1000;
="" strtmp.format(_t("person="" %d="[(%s" %s,="" age="[%d]," salary="[%.2lf])]")," ni,="" [ni].fname,="" [ni].lname,="" [ni].age,="" [ni].salary);
="" m_lstoutput.addstring="" (strtmp);
="" }
=""
="" modifypersonstructarray(ncount,="" );
="" m_lstoutput.addstring(_t("after="" call="=">"));
for (int nI=0; nI
Praveen Kumar Katiyar 12-Dec-19 5:57am View
   
thanks for the quick reply.

but, even changing the calling convention has no effect.

it is same.
Praveen Kumar Katiyar 3-Dec-19 9:20am View
   
You saved my day, what a silly mistake.

Thanks a lot.