>>>I'm trying to call a function in a dll that displays a CDialog derived dialog box. I am calling this DLL from another development environment (Visual FoxPro 5). I keep getting an "Assertion Failed" message when I try to call the function. It is in file AFXWIN1.INL, Line 22. Is there a certain something I need to do to get this to work?
>>>
>>>function code follows:
>>>
>>>char* fTest()
>>>{
>>> char* cTest;
>>
>>// You must allocate memory to cTest before initialize it. Ie:
>>
>>// Where n must be the maximum string length + 1 (for the null terminator)
>>cTest = new( char[n]);
>>
>>> cTest="test";
>>>
>>> TestDialog dlg;
>>> dlg.DoModal();
>>>
>>> return cTest;
>>>};
>>>
>>>Without the dialog stuff the function works fine. And I know the dialog box doesn't have any errors in it. Any ideas would be much appreciated.
>>
>>Can you tell me where exactly (which line inside the function) the error is generated?
>>
>>Vlad
>
>
>Thank you for your reply. The problem was that unless the app calling the DLL was written in Visual C, the function that is called in the DLL must not use any MFC-derived classes. You can avoid this by statically linking the MFC library with the DLL.
>
>Thanks again,
>
>Garritt
Thank you. It's good to know.
Vlad
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement