From: Pascal Bourguignon <pjb@informatimago.com>
Reply-To: <pjb@informatimago.com>
To: yjchenx@hotmail.com
CC: help-gnustep@gnu.org
Subject: Re: Link to C++ library
Date: Tue, 10 Sep 2002 22:38:13 +0200 (CEST)
> From: "Yen-Ju Chen" <yjchenx@hotmail.com>
> Date: Tue, 10 Sep 2002 15:52:52 -0400
>
> Hi,
>
> I try to use the id3lib (http://www.id3lib.org),
> which is a C++ library, but offer the C interface.
> But I met a problem about linking between id3lib and standard C++
library.
> Is it possible to use such C++ library with C interface in GNUstep ?
>
> Yen-Ju
I do link routinely C++ libraries into GNUstep / Objective-C
applications without any problem, passing thru a C interface.
Here is an example of GNUmakefile I used lately. The only notable
thing is the use of the g++ compiler (CC=g++) to compile the
MyCppLibCalls.c file, which contains only simple C functions each
sending a message to a C++ object from libMyCppLib.a, which is a
library of C++ objects.
------------------------------------------------------------------------
include $(GNUSTEP_SYSTEM_ROOT)/Makefiles/common.make
#GNUSTEP_INSTALLATION_DIR = $(GNUSTEP_USER_ROOT)
GNUSTEP_INSTALLATION_DIR=$(INSTALLDIR)
OBJCFLAGS += -g -Wall -DUNIX #-DSTRICT_OPENSTEP
CFLAGS += -g -Wall -DUNIX #-DSTRICT_OPENSTEP
# (For now, the compilation on GNUstep with STRICT_OPENSTEP is broken).
ADDITIONAL_INCLUDE_DIRS = \
-I. \
-IUtilities.subproj \
-I$(INSTALLDIR) \
-I$(INSTALLDIR)/MyCppLib/interfaces
CC=g++
-include GNUmakefile.preamble
SUBPROJECTS=\
Utilities.subproj
include $(GNUSTEP_SYSTEM_ROOT)/Makefiles/aggregate.make
APP_NAME=YyyyTest
YyyyTest_PRINCIPAL_CLASS=YyyyTest
YyyyTest_APPLICATION_ICON=icon.tiff
YyyyTest_RESOURCE_FILES=$(YyyyTest_APPLICATION_ICON)
YyyyTest_RESOURCE_DIRS=
YyyyTest_SUBPROJECTS=$(SUBPROJECTS)
YyyyTest_OTHER_LIBRARIES=\
$(INSTALLDIR)/MyCppLib/libraries/libMyCppLib.a \
/usr/lib/libmcheck.a
YyyyTest_TOOL_LIBS=$(YyyyTest_OTHER_LIBRARIES)
YyyyTest_LIB_DIRS=
YyyyTest_C_FILES=\
MyCppLibCalls.c
YyyyTest_OBJC_FILES=\
YyyyTest_main.m \
YyyyTest.m \
YyyyCLog.m \
YyyyCTree.m \
YyyyVTree.m \
YyyyDictionary.m \
YyyyObject.m \
YyyyLogToCallBack.m \
YyyyFileDS.m \
YyyyReference.m \
YyyyElement.m \
YyyyTree.m
include $(GNUSTEP_SYSTEM_ROOT)/Makefiles/application.make
-include GNUmakefile.postamble
#END#
------------------------------------------------------------------------
--
__Pascal_Bourguignon__ http://www.informatimago.com/
----------------------------------------------------------------------
The name is Baud,...... James Baud.