Discussion:
Static Library problem
(too old to reply)
j***@gmail.com
2008-09-22 06:46:45 UTC
Permalink
Hi all.
I have a probelm when use BCB6 when create static library file. is it
possible to use static library function inside static library project
in bcb6 ?
example:

1. I have test function inside a.lib
int test()
{
return 10;
}

2. In another project. i create b.lib and use test function in a.lib

void test2()
{
test();
}


but when i call test2 in application project. it return error
'unresolved external test()'.

void main()
{
test2();
}

can you help me to solved this problem? thank you
Martin Gäckler
2008-10-22 08:08:31 UTC
Permalink
Post by j***@gmail.com
Hi all.
I have a probelm when use BCB6 when create static library file. is it
possible to use static library function inside static library project
in bcb6 ?
1. I have test function inside a.lib
int test()
{
return 10;
}
2. In another project. i create b.lib and use test function in a.lib
void test2()
{
test();
}
but when i call test2 in application project. it return error
'unresolved external test()'.
void main()
{
test2();
}
can you help me to solved this problem? thank you
Hello,

This should be possible. You have to add both libraries to your
application project. If this hint this not help there are som pitfalls:

Check Compiler settings of both libraries (i.e. calling conventions)
they must be identical. Check whether you mix C++ and C-Code. If you
want to call ANSI-C functions from C++ Code you have to enclose the
prototypes in in an extern Statement:

#ifdef __cplusplus
extern "C" {
#endif

// include your C- protoypes here

#ifdef __cplusplus
};
#endif

Hope this helps

Martin
--
Firma/Company: CRESD GmbH
WWW: http://www.cresd.de
PGP-Key: http://www.cresd.de/edv/pgpkey.txt
Open BC (Einladung) http://www.openbc.com/go/invita/4561755
Continue reading on narkive:
Loading...