This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Linking Linux static library under Cygwin

My problem is the following.

I have a static library libmysqlclient.a, from MySQL version compiled
under Linux (mysql-5.0.45-linux-i686-glibc23).
Is there any possibility to link that library to an object file
complied under Cygwin's GCC?

For instance, I have the following code (test.c):

#include "mysql.h"
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>


int main(int argc,char* argv[])
MYSQL *one, *two;
mysql_server_init(argc, argv, server_groups);


gcc -c test.c

As a result in test.o there is a reference to mysql_server_init()
function as "_mysql_server_init", i.e. with '_' as the first symbol.
In libmysqlclient.a, where the code of mysql_server_init() function is
located, I see a reference to "mysql_server_init" (without '_'

On attempt to link test.o with libmysqlclient.a I get the following error:
test.o: undefined reference to '_mysql_server_init'
because of problem described above.

Linking is initiated by executing such command:
gcc -o mian -L. -lmysqlclient main.o

Thus, could you please explain me:
- Is there any way to link and use Linux libraries under Cygwin at all?
- How can I workaround generation of references with '_' as a first
symbol in test.o?

Thanks in advance!

Problem reports:
Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]