Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a function with extern "C" linkage #7

Closed
GoogleCodeExporter opened this issue Jul 3, 2015 · 10 comments
Closed

Add a function with extern "C" linkage #7

GoogleCodeExporter opened this issue Jul 3, 2015 · 10 comments

Comments

@GoogleCodeExporter
Copy link

This would help with creating 'configure' scripts using autoconf tools.

In particular, the macro 'AC_CHECK_LIB' requires the name of an exported
function.  This function is used to check that the library is available and
can be linked.  The function can be very simple, and serves only as a
public identifier for checking linkage.

For example:

extern "C" char const* gtest_version_cstr()
{
  static char const msg[] = "googletest 1.0.0";
  return msg;
}

Then, in 'configure.ac':

AC_CHECK_LIB( [gtest], [gtest_version_cstr] )

Original issue reported on code.google.com by r.w.john...@gmail.com on 8 Jul 2008 at 7:36

@GoogleCodeExporter
Copy link
Author

Original comment by shiq...@gmail.com on 31 Jul 2008 at 6:38

  • Added labels: OpSys-Linux, OpSys-OSX, Type-Enhancement
  • Removed labels: Type-Defect

@GoogleCodeExporter
Copy link
Author

Chandler, what do you think of this suggestion?

Original comment by shiq...@gmail.com on 17 Sep 2008 at 9:46

  • Changed state: Accepted

@GoogleCodeExporter
Copy link
Author

Alternatively one could use the autoconf macro AX_CXX_CHECK_LIB (http://ac-
archive.sourceforge.net/guidod/ax_cxx_check_lib.html)
i.e.
AX_CXX_CHECK_LIB( gtest, [testing::TestInfo::name() const] )

Original comment by housemaister on 3 Nov 2008 at 8:30

@GoogleCodeExporter
Copy link
Author

Certainly, projects using can use AX_CXX_CHECK_LIB to test for the presence of 
gtest.
 However, that macro is not part of the standard autoconf library, and many projects
may not be setup to use local macros.

The inclusion of gtest_version_cstr would be very simple, and shouldn't break 
anything.

Original comment by r.w.john...@gmail.com on 5 Feb 2009 at 5:34

@GoogleCodeExporter
Copy link
Author

r.w.johnstone, I don't have experience with autotools - would you like to 
submit a 
patch for me to review?  Thanks.

Original comment by zhanyong...@gmail.com on 5 Jun 2009 at 6:27

@GoogleCodeExporter
Copy link
Author

zhanyong.wan, the patch is more or less outlined in the original post that 
opened
this issue.  The goal is to simply provide a function with C linkage, which can 
be
found by autotools.  A new source file, simply version.c, with the following 
function:

extern "C" char const* gtest_version_cstr()
{
  static char const msg[] = "googletest 1.0.0";
  return msg;
}

The exact body of the function is actually secondary.

Original comment by r.w.john...@gmail.com on 5 Jun 2009 at 7:49

@GoogleCodeExporter
Copy link
Author

Lower the priority since autotools is being phased out.

Original comment by w...@google.com on 23 Dec 2009 at 6:59

  • Added labels: Priority-Low, Usability
  • Removed labels: Priority-Medium

@GoogleCodeExporter
Copy link
Author

@w...@google.com
The version function is an improvement for uses of gtest that use autotools (or 
other build tools like scons). As I 
see it, it is not related to the build system used by gtest itself.

Original comment by dirk....@gmail.com on 23 Dec 2009 at 7:27

@GoogleCodeExporter
Copy link
Author

@dirk.mst, you are right that the two are different things.  That's why I didn't
close the issue as "won't fix".  Some users of gtest choose autotools because 
gtest
uses it.  After we switch away from autotools, such users won't have a reason 
to use
autotools any more.  Therefore the priority of this is lowered.

Original comment by w...@google.com on 23 Dec 2009 at 3:54

@GoogleCodeExporter
Copy link
Author

We now consider it a bad practice to install pre-compiled gtest -- see
http://code.google.com/p/googletest/wiki/FAQ?ts=1285613232&updated=FAQ#Why_is_it
_not_recommended_to_install_a_pre-compiled_copy_of_Goog

Therefore I'm closing this as "won't fix".

Original comment by w...@google.com on 27 Sep 2010 at 6:49

  • Changed state: WontFix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant