Click to See Complete Forum and Search --> : Configuring ODBC Data Source Names


May 5th, 1999, 04:37 AM
Hai,
I used SqlConfigDataSource to configure datasources dynamically.If i use to call this function from
WinMain it works fine.But if i try to invoke it from main it give unresolvable symbol WinMain@16.

Can we do it directly using MFC's?

My problem is i have to create a dll and use it from another C application.I got success in creating an ordinary dll.
But when i try to invoke that function from my application during linking it self it gave the error unable to resolve extranal symbol WinMain@16.

Thanks for any help

with regards,
SubbaRao

PeterK
May 5th, 1999, 02:38 PM
SqlConfigDataSource is part of the ODBC API. As far as I know there are no MFC Classes that wrap around this specific call.

Sounds like you are having trouble using the ODBC API in a Win32 DLL.

bvsrao
May 5th, 1999, 11:37 PM
Hai,
I created a MFC dialog based application and inside it i incorporated the logic for
configuring ODBC DataSourceNames.It worked fine.Later i created a MFC extension DLL and included my Dialog resource
class and export those functions required for configuring DSNs.When i try to use this DLL directly in my C application
i'm fvacing the same problem unresolve external symbol WinMain@16.

Is there any need to include some other libraries in project work space?If so , please tell me which libraries should i include.

Thanks for any help,

With Regards,
SubbaRao

PeterK
May 6th, 1999, 11:34 AM
Hmmm...

Trying to call functions from a MFC DLL while using C.

Don't know if you've thought of this.

C++ using name mangling when creating the symbols for each function in the DLL. C does not use name mangling. To avoid name manglind you must EXTERN C your functions.

*** myDll.h

#ifdef WFSAPI_BUILDDLL
# define WFSAPI_EXPORT __declspec(dllexport)
#else
# define WFSAPI_EXPORT __declspec(dllimport)
# pragma comment (lib, "wfsapi.lib")
#endif

extern "C" WFSAPI_EXPORT void APIENTRY wfsErrorBox(char *title, char *msg1, char *msg2, char *msg3);

***

Good luck, hope this helps.

bvsrao
May 7th, 1999, 05:14 AM
Hai Peter,

Thanks for ur replies.Actually i used that extern "C" linkage , while i'm doing exports and imports.

It's like
extern "C"
int AddDSN(char *Path,char *dsn);

extern "C"
int RemoveDSN(char *Path,char *dsn);

And i wrote one small CPP file and i try to call this AddDSN & RemoveDSN functions.
During linking time the following line is the error , i'm getting.
msvcrtd.lib(crtexew.obj) : error LNK2001: unresolved external symbol _WinMain@16

please if possible find the problem.

Thanks for the help

with regards,
SubbaRao

January 3rd, 2000, 08:06 AM
Hai,
How to create an Oracle DSN dynamically from MFC? I can able to create Ms-Access,Ms-excel etc., DSNs dynamically
using SQLConfigDatasource function. But when i am creating Oracle DSN, Its not adding service name, User id in DSN
details. So help me for the same.

Thanking you
Srinivas

my Email: srinu_bns@usa.net