Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Issues in building a shared library

44 views
Skip to first unread message

Arun

unread,
Mar 19, 2012, 2:39:47 PM3/19/12
to
Hello,
I am trying to build a shared library called "libjxx.so" using Visual
studio2008 V9.0. The module contains both C & fortran routines. I am
making the C-source as start up project and linking the F-source
against it. I am also linking couple of other libraries called
libm7.lib & libm8.lib. I am getting the following errors concerning
undefined references.

libjxx_F.lib(jmxx_cmd.obj) : error LNK2019: unresolved external
symbol
half_initialise_ referenced in function jm45_init_
libjxx_F.lib(jmxx_cmd.obj) : error LNK2019: unresolved external
symbol
half_get_error_msg_ referenced in function jm45_init_
libjxx_F.lib(jmxx_read.obj) : error LNK2001: unresolved external
symbol half_get_error_msg_
libjxx_F.lib(jmxx_write.obj) : error LNK2001: unresolved external
symbol half_get_error_msg_


These symbols are basically present in libm7.lib. I am sure i am
linking this library correctly with paths are in place in the
"Additional library directories" section. Also i am inputting the
additional directories in correct linking order ie., after the
concerned module. My suspicion is that i am linking a ".lib" which is
nothing but a static library to form a final shared library (.so).
Should libm7 be compiled as a shared module and then linked against
the sources of libjxx? I am not pretty sure on this.


Any ideas or suggestions in this regard would be highly appreciated.
Thanks in advance,
Arun
--
comp.lang.c.moderated - moderation address: cl...@plethora.net -- you must
have an appropriate newsgroups line in your header for your mail to be seen,
or the newsgroup name in square brackets in the subject line. Sorry.

Arun

unread,
Mar 19, 2012, 2:40:17 PM3/19/12
to

George Neuner

unread,
Mar 19, 2012, 6:55:55 PM3/19/12
to
On Mon, 19 Mar 2012 13:39:47 -0500 (CDT), Arun <abar...@gmail.com>
wrote:
Windows can not use Unix/Linux .so libraries, so Visual Studio does
not recognize or create them. I'm guessing that what you really want
to do is to build a Windows library: a DLL. Otherwise you should not
be using Visual Studio.

WRT the errors - based on your comments, they would appear to be the
result of incompatible name mangling. I'm not very familiar with
Fortran (and I didn't know there even was a Visual Studio compiler),
but if your Fortran provides some way to explicitly specify external
linkage, then you may be able to reference the routines in that way.

If the libraries really are Windows (and not Unix), then you should be
able to use the VS dumpbin utility to find the actual symbol names and
indexes, and create a linker .def file that maps the names in the code
to the symbols in the library. That is, unfortunately, an ad hoc
process that I can't talk you through. You'll need to read the docs
regarding .def files and learn how to use dumpbin.

If the libraries are Unix/Linux, you're screwed. You'll have to
locate source and recompile them for Windows.

Hope this helps.
George

Jasen Betts

unread,
Mar 25, 2012, 10:43:23 PM3/25/12
to
On 2012-03-19, Arun <abar...@gmail.com> wrote:
> Hello,
> I am trying to build a shared library called "libjxx.so" using Visual
> studio2008 V9.0.

what do you intend to do with this file once produced?
can VS produce even ELF binaries ?
shouldn't you be trying to make libjxx.dll?

--
⚂⚃ 100% natural

--- Posted via news://freenews.netfront.net/ - Complaints to ne...@netfront.net ---
0 new messages