building and using DatabaseLayer with Mingw for Firebird

Talk here about issues with one of the components hosted at wxCode, or suggest features for it.
Post Reply
RomanV
Knows some wx things
Knows some wx things
Posts: 32
Joined: Tue Mar 27, 2007 10:29 am
Contact:

building and using DatabaseLayer with Mingw for Firebird

Post by RomanV »

I am trying to make Firebird version of DatabaseLayer working.
Compilation of libwxcode_msw28d_databaselayer_firebird.a went smoothly.
I just used the command line command:
mingw32-make -f makefile.gcc firebird

Then I tried to make compilation of examples:

mingw32-make -f makefile.gcc firebird_test

I produced a lot of errors like:
undefined reference to `_isc_attach_database@24'

I created fbclient.a by the following:
reimp -d fbclient_ms.lib
-k --input-def fbclient.def --dllname fbclient.dll --output-lib fbclient.a

So I put fbclient.a, fbclient.def, fbclient.dll into appropriate paths.

But I still getting many "undefined reference " errors.
Maybe order list of libs for DatabaseLayer is wrong.

Then I created a simple C file to try to compile it with minimum info:


Code: Select all

#include <iostream>
#include "ibase.h"

using namespace std;

int main (int argc, char *argv[])
{

  isc_db_handle m_pDatabase;
  ISC_STATUS_ARRAY m_Status;
  
  short nDpbLength = 0;
  
  char* pDpb;
  char* urlBuffer;
  
  //isc_version(
  
  isc_attach_database(m_Status, 0, urlBuffer, &m_pDatabase, nDpbLength, pDpb);
  
  cout << "Hello World!" << endl;
  cout << "Press ENTER to continue..." << endl; 
  cin.get();
  return 0;
}

File can be compiled fine with the command:
mingw32-g++.exe -Wall -pipe -mthreads -D__GNUWIN32__ -D_DEBUG -I"C:\Program Files\Firebird\Firebird_2_5\include" -c main.cpp -o main.o


Then I get the same error undefined reference to `_isc_attach_database@24' when linking the file with the command:

mingw32-g++.exe main.o -o main.exe -L"C:\Program Files\Firebird\Firebird_2_5\lib" -L"C:\Program Files\Firebird\Firebird_2_5\bin" -lrpcrt4 -lwinmm -lws2_32 -lwldap32 -luser32 -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lcomctl32 -lwsock32 -lodbc32 -lfbclient

What could be wrong?
Finally I cannot use libwxcode_msw28d_databaselayer_firebird.a in my WX application because I am having the same linking problems.
RomanV
Knows some wx things
Knows some wx things
Posts: 32
Joined: Tue Mar 27, 2007 10:29 am
Contact:

Post by RomanV »

I found the solution:
I installed Firebird into C:\Firebird
instead of Program Files
Then I compiled Firebird using Visual Studio 2005
Then I copied all fbclient.* files into C:\Firebird\lib
and after running just reimp fbclient.lib it created fbclinet.a

So all other steps were successful.
Note: mingw compiled version of DatabaseLayer runs fine with Firebird.

Outcome: I spent several hours on finding solution.
I am not sure: was it because Firebird was installed into Program Files
or was that fbclient.dll of Firebird's distribution was compiled by Visual Studio 2008 instead of VS 2005.
(maybe reimp created incorrect .a file).
Post Reply