>extern "C" __declspec(dllexport)CString addstring(CListBox &list,CString
text)
>{
>list.AddString(test);
>return text;
>}

This is perfectly fine, yes.

>extern "C" __declspec(dllexport)CListBox copylist(CListBox list)
>{
>return list;
>}

For this one I would recommend the following alternative:

extern "C" __declspec(dllexport) void copylist(CListBox &listCopyFrom,
CListBox &listCopyTo)
{
        // Copy list items across here.
}

The reason for this is that a CListBox is a Windows control, and so you have
two things to consider: (1), creating that new list box, and (2), filling
it. I thus recommend that you create it in the source program and only fill
it with a copy of everything in the source list from within the DLL. This
might not be a problem at this stage, but in the future if you start
creating threads, it will become one.

Secondly, it is wasteful to return whole objects from functions, exactly the
same as it is wasteful to pass whole objects TO functions. Thus, using a
reference both for the source and destination is a good idea.

--
Jason Teagle
[EMAIL PROTECTED]



_______________________________________________
msvc mailing list
[email protected]
See http://beginthread.com/mailman/listinfo/msvc_beginthread.com for 
subscription changes, and list archive.

Reply via email to