I have an application that needs to import a DLL file for some
database call like -

#import "c:\Program Files\Common Files\System\ADO\msado15.dll" \
rename("EOF", "EndOfFile")

the path is OS dependent - what if I run on some other PC but the
msado15.dll is not specificed in the path specified? for this case -
#import "c:\Program Files\Common Files\System\ADO\

any easy way to work around this problem where I don't have a hard
coded path in my code??



============

#import "c:\Program Files\Common Files\System\ADO\msado15.dll" \
rename("EOF", "EndOfFile")

typedef ADODB::_RecordsetPtr RecPtr;
typedef ADODB::_ConnectionPtr CnnPtr;

class Database;
class Table;

class Database
{
public:
CnnPtr m_Cnn;
char m_ErrStr[500];
Database();
bool Open(char* UserName, char* Pwd,char* CnnStr);
bool Execute(char* CmdStr, Table& Tbl);
void GetErrorErrStr(char* ErrStr);
};

class Table{
public:
RecPtr m_Rec;
char m_ErrStr[500];
Table();
void GetErrorErrStr(char* ErrStr);
int ISEOF();
HRESULT MoveNext();
HRESULT MovePrevious();
HRESULT MoveFirst();
HRESULT MoveLast();

bool Get(char* FieldName, char* FieldValue);
bool Get(char* FieldName,SYSTEMTIME& FieldValue);
bool Get(char* FieldName,int& FieldValue);

BOOL VariantTimeToSystemTimeWithMilliseconds (/*input*/ double
dVariantTime, /*output*/SYSTEMTIME *st);
};

Re: import library by David

David
Tue Apr 15 01:45:12 CDT 2008

>I have an application that needs to import a DLL file for some
>database call like -
>
>#import "c:\Program Files\Common Files\System\ADO\msado15.dll" \
> rename("EOF", "EndOfFile")
>
>the path is OS dependent - what if I run on some other PC but the
>msado15.dll is not specificed in the path specified?

Make a copy of the DLL and put it in your source build directory.

Dave

Re: import library by SvenC

SvenC
Tue Apr 15 01:53:24 CDT 2008

Hi Jim

> I have an application that needs to import a DLL file for some
> database call like -
>
> #import "c:\Program Files\Common Files\System\ADO\msado15.dll" \
> rename("EOF", "EndOfFile")
>
> the path is OS dependent - what if I run on some other PC but the
> msado15.dll is not specificed in the path specified? for this case -
> #import "c:\Program Files\Common Files\System\ADO\
>
> any easy way to work around this problem where I don't have a hard
> coded path in my code??

The path is only used during compile time, not in runtime.

When you want to compile it on different machines, several options:

Copy the dll into your project and import it without path.

If you are using VC2003 and up you can use
#import "libid:here comes the libid" version("x.y")
#import "progid:ADODB.Connection"

The above lines will lookup the path through registry lookups.

--
SvenC

Re: import library by Leo

Leo
Fri May 30 19:23:10 CDT 2008

What you are describing is a system configuration issue. In other words,
you're source code is dependent on some 3rd party library that is installed
on the system. Since that is the case, you don't want to reference it from
your project settings because that would mean hard-coding an absolute search
path into your project.

Here's a couple alternatives. We do option 1 below:

1. Document that your project requires MSADO15.DLL to be installed on the
system and that the folder it is installed in be added to
Tools|Options|Project and Solutions|VC++ Directories|Include Files.

2. Add in your source tree some sort of 3rdPartyLibs\MSADO folder and put a
copy of the DLL there. Then, add that folder to the include search path for
whatever project needs to build it.


"Jim Johnson" <aopiyy001@yahoo.com> wrote in message
news:oi98041cr9ujdejgkhsai7ooi5qc7a9dg8@4ax.com...
>I have an application that needs to import a DLL file for some
> database call like -
>
> #import "c:\Program Files\Common Files\System\ADO\msado15.dll" \
> rename("EOF", "EndOfFile")
>
> the path is OS dependent - what if I run on some other PC but the
> msado15.dll is not specificed in the path specified? for this case -
> #import "c:\Program Files\Common Files\System\ADO\
>
> any easy way to work around this problem where I don't have a hard
> coded path in my code??
>
>
>
> ============
>
> #import "c:\Program Files\Common Files\System\ADO\msado15.dll" \
> rename("EOF", "EndOfFile")
>
> typedef ADODB::_RecordsetPtr RecPtr;
> typedef ADODB::_ConnectionPtr CnnPtr;
>
> class Database;
> class Table;
>
> class Database
> {
> public:
> CnnPtr m_Cnn;
> char m_ErrStr[500];
> Database();
> bool Open(char* UserName, char* Pwd,char* CnnStr);
> bool Execute(char* CmdStr, Table& Tbl);
> void GetErrorErrStr(char* ErrStr);
> };
>
> class Table{
> public:
> RecPtr m_Rec;
> char m_ErrStr[500];
> Table();
> void GetErrorErrStr(char* ErrStr);
> int ISEOF();
> HRESULT MoveNext();
> HRESULT MovePrevious();
> HRESULT MoveFirst();
> HRESULT MoveLast();
>
> bool Get(char* FieldName, char* FieldValue);
> bool Get(char* FieldName,SYSTEMTIME& FieldValue);
> bool Get(char* FieldName,int& FieldValue);
>
> BOOL VariantTimeToSystemTimeWithMilliseconds (/*input*/ double
> dVariantTime, /*output*/SYSTEMTIME *st);
> };
>