First scenarion :
I'm using AfxDaoInit() from win32 C console application it works fine.
I created a win32 C dll, that has a method below
I have managed C# .exe that using Interop.Services to call Init function.
DLLEXPORT void Init()
I can see that it reach the Init function, but it fails on AfxDaoInit().
Is there any problem running AfxDaoInit() from non-GUI thread?
I'll appreciate your help.
>> Is there any problem running AfxDaoInit() from non-GUI thread?
I'm not sure, but AfxDaoInit is for applications that are properly linked with the MFC libraries, so perhaps they aren't being loaded? On a side note, it looks like AfxDaoInit is deprecated, so you should probably use a more up-to-date API.
I'm not familiar with DAO and very little with MFC. Can you please explain how can check if MFC libraries are loaded?
The strange thing is that the same code run perfect from win32 console application.
IIRC you need to call
iwithin any exported function in a DLL that uses MFC.