|
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
|
|
|
|
|
Yeah,
Sorry i found it myself,as AtlCom wizard itslef Provide support for Event,you just mere have to Check the IConnectionPoint Box ,rets of thing will be handle by Wizard itself
-----------------------------
"I Think It Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
I have develop a List view control. Control has propert Columns which implements the IColumns interface. Now i want to persist this property by including it in Prop map.
Below is the code
<br />
BEGIN_PROP_MAP(CGridAdv)<br />
PROP_ENTRY("Columns", 14, CLSID_ColumnsProp)<br />
END_PROP_MAP()<br />
After doing that control crashes whenever container try to dislay it.
Can anyone tell me how to do that?
thanks
qur
|
|
|
|
|
Is there a way to get ostream_iterator to work with pair?
typedef int Number;
typedef float Voltage;
typedef pair<Number, Voltage> SamplePair;
std::ostream& operator<<(std::ostream& stream, const SamplePair& sample)
{
return stream << "Number: " << sample.first << ", Voltage: " << sample.second;
}
void ostreamIteratorPairTest()
{
typedef vector<SamplePair> Samples;
Samples samples;
for (int i = 1; i <= 10; i++)
{
SamplePair sample(i, float(i));
samples.push_back(sample);
cout << sample << endl;
}
copy (samples.begin(), samples.end(),
ostream_iterator<Sample>(cout, "\n"));
}
int main(int argc, char* argv[])
{
ostreamIteratorTest();
return 0;
}
In VC6 I get the following error:
c:\program files\microsoft visual studio\vc98\include\xutility(19) : error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'struct std::pair<int,float>' (or there is no acceptable conversion)
C:\Program Files\Microsoft Visual Studio\MyProjects\ConsoleTest\ConsoleTest.cpp(120) : see reference to function template instantiation 'class std::ostream_iterator<struct Sample,char,struct std::char_traits<char> > __cdecl std::copy(struct
std::pair<int,float> *,struct std::pair<int,float> *,class std::ostream_iterator<struct Sample,char,struct std::char_traits<char> >)' being compiled
Error executing cl.exe.
In VC7.1 I get a slightly different error saying that operator << hasn't been defined for pair when it has.
Kevin
|
|
|
|
|
Umm, you've stumbled on a particular tricky issue with argument-dependent lookup (ADL, also called Koenig lookup, if you don't know what this is just ask).
ostream_iterator tries to find operator<< in the namespace where ostream and SamplePair belong, namely std --SamplePair is just a typedef of std::pair , so it is really std::pair that's being used. And you've defined your operator<< in the global namespace, hence the problem.
One dirty hack is to just define the thing inside namespace std :
#include <iostream>
#include <utility>
#include <vector>
#include <iterator>
typedef int Number;
typedef float Voltage;
using namespace std;
typedef pair<Number, Voltage> SamplePair;
namespace std{
std::ostream& operator<<(std::ostream& stream, const SamplePair& sample)
{
return stream << "Number: " << sample.first << ", Voltage: " << sample.second;
}
}
void ostreamIteratorPairTest()
{
typedef vector<SamplePair> Samples;
Samples samples;
for (int i = 1; i <= 10; i++)
{
SamplePair sample(i, float(i));
samples.push_back(sample);
cout << sample << endl;
}
copy (samples.begin(), samples.end(),
ostream_iterator<SamplePair>(cout, "\n"));
}
int main(int argc, char* argv[])
{
ostreamIteratorPairTest();
return 0;
} But take this into account: strictly speaking, the former is not legal C++; the language does not allow you to overload any function in namespace std . AFAIK there's nothing you can do to prevent this, except turn SamplePair into an actual user-defined type (maybe by inheriting from std::pair and adding the proper constructors.) IMHO, you can just leave the thing as it is, knowing that it is not conformant C++.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
Want a Boost forum in Code Project? Vote here[^]!
|
|
|
|
|