CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Guest

    Configuring ODBC Data Source Names

    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


  2. #2
    Join Date
    May 1999
    Location
    Wisconsin, USA
    Posts
    953

    Re: Configuring ODBC Data Source Names

    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.



  3. #3
    Join Date
    May 1999
    Posts
    2

    Re: Configuring ODBC Data Source Names

    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


  4. #4
    Join Date
    May 1999
    Location
    Wisconsin, USA
    Posts
    953

    Re: Configuring ODBC Data Source Names

    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.



  5. #5
    Join Date
    May 1999
    Posts
    2

    Re: Configuring ODBC Data Source Names

    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




  6. #6
    Guest

    Re: Configuring ODBC Data Source Names

    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: [email protected]


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured