linking multiple function from .lib to CYGWIN

Mümin A. muminaydin06@gmail.com
Fri Jul 14 08:51:59 GMT 2023


Hi,

I can only link one function at a time in a *msvc *built library but when I
use multiple functions in the CYGWIN
compiler,  I got that error message.

int main()
{
helloWorld2();
return 0;
}

That is compiled and linked successfully.

int main()
{
helloWorld2();
helloWorld3();
return 0;
}

That is  compiled but linking throws  a bug report.

[ 50%] Linking CXX executable a.exe
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld:
internal error: aborting at
/mnt/share/cygpkgs/binutils/binutils.x86_64/src/binutils-2.40/ld/ldlang.c:527
in compare_section
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld:
please report this bug
-------------- next part --------------
#ifndef FOOCLS_H
#define FOOCLS_H

#if defined(_WIN32) || defined(__CYGWIN__)
#ifdef DLL_EXPORT
#define _WIN_DLL __declspec(dllexport)
#else
#ifdef _MSC_VER
#define _WIN_DLL __declspec(dllimport)
#else
#define _WIN_DLL
#endif
#endif
#else
#define _WIN_DLL
#endif

#ifdef __cplusplus
extern "C"
{
#endif

     _WIN_DLL  void helloWorld2(void);
     _WIN_DLL  void helloWorld3(void);

#ifdef __cplusplus
}
#endif

#endif // FOOCLS_H
-------------- next part --------------
#include <fooCls.h>

int main()
{
	helloWorld2();
	
	helloWorld3();	

	return 0;
}


More information about the Cygwin mailing list