|
Since we don't have OLE DB forum I think ATL is pretty close.
So!
I got a prob. I'm using a recordset with CDynamicAccessor.
when I close it it crashes in here:
in ATLDBCLI.H
<br />
class CAccessorBase<br />
.....<br />
HRESULT ReleaseAccessors(IUnknown* pUnk)<br />
{<br />
ATLASSERT(pUnk != NULL);<br />
HRESULT hr = S_OK;<br />
if (m_nAccessors > 0)<br />
{<br />
CComPtr<IAccessor> spAccessor;<br />
hr = pUnk->QueryInterface(IID_IAccessor, (void**)&spAccessor);<br />
if (SUCCEEDED(hr))<br />
{<br />
ATLASSERT(m_pAccessorInfo != NULL);<br />
for (ULONG i = 0; i < m_nAccessors; i++)<br />
spAccessor->ReleaseAccessor(m_pAccessorInfo[i].hAccessor, NULL);<br />
}<br />
m_nAccessors = 0;<br />
delete [] m_pAccessorInfo;
m_pAccessorInfo = NULL;<br />
}<br />
return hr;<br />
}<br />
Why that delete fails? I mean this code allocates it why can't it delete?
The only other note is that I put my code that uses this in a regular windows DLL. Could that be a prob?
|
|
|
|
|
inner wrote:
The only other note is that I put my code that uses this in a regular windows DLL. Could that be a prob?
Yes that could be the problem. Make sure your app and DLL links against the same C runtime library. If they don't, then they will get separate heaps. The heap is where memory is allocated from by using new, and returned to when deallocated using delete. If you allocate memory in the DLL, and delete it in the app, then errors will occur if they do not share the same heap.
--
Weiter, weiter, ins verderben.
Wir müssen leben bis wir sterben.
|
|
|
|
|
Need suggestions for the problem preferrably in VC6:
There are two machines A and B. A telnet(or SSH) to B.On logged in to B, B should give it's own window in Machine A. That is, B should be the owner of window in A.
If it is something to do with XWindows or Xterm, I am not clear how exactly to hit the problem.
I hate that lazy Java
|
|
|
|
|
i am working on a project which needs vc7 specific dlls ( atl71.dll msvcr71.dll etc) which i need to ship to the client thro the setup.
Since these dlls are not registered where should my setup register / copy these dlls so that my code uses them. if these are not COM dlls then how do they get referenced when any piece of code uses them?
|
|
|
|
|
Same directory as the binary or a directory which is in the PATH environment variable, C:\Windows[\system32]. I'd opt for same directory as binary, just to make sure no other app replaces your dll's.
--
Weiter, weiter, ins verderben.
Wir müssen leben bis wir sterben.
|
|
|
|
|
Installing anything into windows and/or system32 is discouraged these days, because it leads to DLL Hell™. Installing into the app dir, and creating a APPNAME.exe.local file is the way to go on Win2K+.
--
I'm Michael Dunn and I approve this post.
Vote Trogdor in oh-four!
|
|
|
|
|
What's the .local file for?
--
Weiter, weiter, ins verderben.
Wir müssen leben bis wir sterben.
|
|
|
|
|
In short, it tells the OS to load DLLs from the EXE's directory if they exist there, before searching the normal path for DLLs. More info here[^]
--
I'm Michael Dunn and I approve this post.
Vote Trogdor in oh-four!
|
|
|
|
|
Hmm.. wait. The beside-executable option may not work on Win9x. I'm not sure.
--
Weiter, weiter, ins verderben.
Wir müssen leben bis wir sterben.
|
|
|
|
|
Don't quote me on this but I recall that on NT4 (at least with SP3) and older OS such as Win9X the dll loading first looks in the system folders and then looks in the application folder ("beside-executable" option), resulting in windows loading what ever version is in the system and not the new version that is in your application folder.
As opposed to W2K and XP that first look in the application folder and then in the system folders.
|
|
|
|
|
This page implies that Windows looks in the application folder first for DLLs.
Stuart Dootson
'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p'
|
|
|
|
|
Hi,
I'm using WTL7 (also tried WTL71) for a project that has to be kept small, so I'm using ATL_MIN_CRT when doing the release build, this works fine in VC6, no compile or link errors.
But, here's the problem, if I try to upgrade the project to VS.NET2003, the release build will not link properly, giving the following errors:
Linking...
LIBCMT.lib(crt0dat.obj) : error LNK2005: __osplatform already defined in atlmincrt.lib(atlinit.obj)
LIBCMT.lib(crt0.obj) : error LNK2019: unresolved external symbol _main referenced in function _mainCRTStartup
I know this is saying that something is causing the compiler/linker to use CRT, which fails due to ATL_MIN_CRT. Skipping ATL_MIN_CRT is not an option.
I have checked the project settings and everything seems to be correctly upgraded from VS6 to VS.NET2003 and the code haven't changed.
What could be the problem? Is it still a matter of trying to track down what function call is pulling in the CRT lib? This is anoying since, well, it worked before.
Any ideas or things to keep in mind when working with WTL and VS.NET2003?
Cheers!
|
|
|
|
|
OK, found it. I had an atoi() call somewhere, replacing that with StrToInt() did the trick. Strange that it worked in VS6 but not VS.NET2003.
Cheers
|
|
|
|
|
I believe you can find these dependencies quite easy. Link dynamically against the CRT without ATL_MIN_CRT. Launch the Dependency Walker (Depends.exe in your VS.NET tools directory), and open your binary with it. Locate the MSVCRT.DLL entry in the tree view and select it. On the right hand side you see two list views with function entry points. The top list view contains the functions which you import from the selected DLL. From there on, it's just a matter of Find in Files to rid yourself of the offending function call(s).
--
Weiter, weiter, ins verderben.
Wir müssen leben bis wir sterben.
|
|
|
|
|
Nice, I did not know this, that makes it a lot easier. Thanks!
|
|
|
|
|
thanks mr Jörgen for this great help
-----------------------------
"I Think It Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
|
Well, upon further testing my code works just fine when the service is register and started, so I'm guessing the problem comes in when trying to run the service in debug mode in vs.net. Anyone have link on how to debug a service? It seems that just unregistering the service, compiling in debug mode and then running it doesn't work correctly. I haven't fully traced into the ATL code yet though.
|
|
|
|
|
could anyone give me information on: how to access database in ATL (using visual c++)?
thanks
|
|
|
|
|
|
Thanks! but to use OLEDB: Do u need MFC support? I want something without MFC support.
|
|
|
|
|
Nope, you don't need MFC.
BTW, there was a beginners' article for using OLEDB templates here on CP. Just search for OLEDB and I am sure you will find it.
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
|
|
|
|
|
Hello,
ATL does not provide any intrinsic database access functionalities. You acess any database system of your choice using the APIs provided by that database system.
However, if you want to access databases using ADO (Active Database Objects) (which is COM-based), you would import the Type Library of ADO (using the #import statement) and then connect to the database of your choice via the appropriate connection string.
Note that your database system must also support ADO (most do anyway). Examples of database systems that support ADO are : MS Access, Oracle, SQL Server, Sybase.
Regards,
Bio.
|
|
|
|
|
Thanks for the info. I will look for ADO, and if I could not find anything useful I will contact u.
|
|
|
|
|
I am new to COM/ATL,i have very beginner question, i want to know ho wto create events and raise that event in From ATL DLL.
thanks for every Suggestion
-----------------------------
"I Think It Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|