Обсуждение: libpq.dll and VB
Hello. Has anybody got any experience using libpq.dll from Visual Basic (currently using Visual Studio 6), and if so, do you have the declarations handy. I have a little trouble finding out how the PGconn and PGresult should look like, and as far as I know these are required to use the connect and execute functions in the library. Yours faithfully. Finn Kettner. PS. If anybody know a program to automatically extract informations from a dll and create a api.txt file for Visual Basic, then please let me know.
> Hello. > > Has anybody got any experience using libpq.dll from Visual Basic > (currently using Visual Studio 6), and if so, do you have the > declarations handy. I have a little trouble finding out how the PGconn > and PGresult should look like, and as far as I know these are required > to use the connect and execute functions in the library. > > Yours faithfully. > Finn Kettner. > PS. If anybody know a program to automatically extract informations > from a dll and create a api.txt file for Visual Basic, then please let > me know. I don't know exactly which format VB expects, but you can get a list of exports from the DLL using: dumpbin /exports libpq.dll If you also need the function definitions, check libpq-fe.h for C style syntax. (It's in src/interfaces/libpq) As a sidenote, you may be much better off using ADO with the ODBC driver - it's definitly move VB-friendly. //Magnus
On 24 Aug 00 at 16:51, Magnus Hagander wrote about RE: [HACKERS] libpq.dll and VB: > > Has anybody got any experience using libpq.dll from Visual Basic > > (currently using Visual Studio 6), and if so, do you have the > > declarations handy. I have a little trouble finding out how the PGconn > > and PGresult should look like, and as far as I know these are required > > to use the connect and execute functions in the library. > > PS. If anybody know a program to automatically extract informations > > from a dll and create a api.txt file for Visual Basic, then please let > > me know. > I don't know exactly which format VB expects, but you can get a list > of exports from the DLL using: dumpbin /exports libpq.dll Yes, I've tried that, but unfortunately, that is not exactly the format that VB need, but I have considered using it as a starting point. > If you also need the function definitions, check libpq-fe.h for C > style syntax. (It's in src/interfaces/libpq) I need function definitions and structure (called Type in VB) definitions, and yes I have looked in libpq-fe.h, actually this is the placed where the dll is build :-). But as mentioned earlier, the structures for PGconn and PGresult is not in this file (they are typedef'ed directly from pg_conn and pg_result, which I can't find in any of the included files, so I actually wonder how the dll is build in the first place???). > As a sidenote, you may be much better off using ADO with the ODBC > driver - it's definitly move VB-friendly. Yes, but what I forgot to tell you, is that I'm trying to create a activex control, which is to be placed on a (intranet) web page, using the Esker plugin, so ODBC is not the best way to go, as that would need a ODBC-connection be set up on each client machine, which are to use the activex control, so that's why I need to go directly to the dll file (which can be fetched from the page). To set up an ODBC connection you would need to install the psqlodbc.dll anyway, so why not take the direct way. Yours faithfully. Finn Kettner.
> > If you also need the function definitions, check libpq-fe.h for C > > style syntax. (It's in src/interfaces/libpq) > > I need function definitions and structure (called Type in VB) > definitions, and yes I have looked in libpq-fe.h, actually this is > the placed where the dll is build :-). But as mentioned earlier, the > structures for PGconn and PGresult is not in this file (they are > typedef'ed directly from pg_conn and pg_result, which I can't find in > any of the included files, so I actually wonder how the dll is build > in the first place???). Ahh. Ok. Those are defined in 'libpq-int.h', in the same directory. But be careful with possibly accessing any of the members directly - use the accessor functions instead. They have been moved into the -int file in order to make it harder to find them directly for just that reason :-) > > As a sidenote, you may be much better off using ADO with the ODBC > > driver - it's definitly move VB-friendly. > > Yes, but what I forgot to tell you, is that I'm trying to create a > activex control, which is to be placed on a (intranet) web page, > using the Esker plugin, so ODBC is not the best way to go, as that > would need a ODBC-connection be set up on each client machine, which > are to use the activex control, so that's why I need to go directly > to the dll file (which can be fetched from the page). To set up an > ODBC connection you would need to install the psqlodbc.dll anyway, so > why not take the direct way. Ok, that puts it in different light. You could always construct the connection string on-the-fly so you don't need to create an actual datasource (specifying the driver manually), but you would still ned to get the DLL file onto the client, possibly along with some registry entries. (For libpq, you definitly need only the DLL, and nothing in the registry). //Magnus