Author Topic: [OT] LIB woes  (Read 3144 times)

Olego

  • Posts: 557
[OT] LIB woes
« on: 6 Aug '03 - 23:26 »
Hello everyone,

My question doesn't have direct relevance to BASS other than the fact that I am making a LIB file in C/C++, and it involves threading.

I figured out the basic threading and the necessity to switch to /MT option for the linker (I use Visual Studio).  I also figured out that the project that uses my library needs to be /MT, otherwise it has runtime errors involving threads etc.

But then I realised that I need a C++ project for my C++ library.  Once I converted my library to C, C users could run it but C++ users couldn't.

Does anyone know more info on how to write libraries accessible using both C and C++, and how I should deal with threading (other than by making every .exe use the /MT switch)?  Please help!
~Olego~

Olego

  • Posts: 557
extern
« Reply #1 on: 7 Aug '03 - 22:58 »
Aha!  I knew there was something more to
Code: [Select]
extern "C" { ... } than there seemed.  Perhaps that'll aid me in my struggles!~Olego~

Olego

  • Posts: 557
__cplusplus
« Reply #2 on: 8 Aug '03 - 00:00 »
So...  That is that is meant by
Code: [Select]
#ifdef __cplusplus
extern "C" {
#endif
!  Well, that seemed to have fixed my problems.  Furthermore,
Code: [Select]
_declspec (dllexport)seemed to have created a successful DLL with a LIB. Is that how you made your LIB file, Ian?~Olego~