473,395 Members | 1,972 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

calling NAG from C

Dear all,

I wrote a c program and tried to call NAG(desinged for FORTRAN)subroutine.

I called as NAG as below

d02bhf_( &x, &xend, &knor , y, &tol,&irelab, &hmax, &fcn, &g, w, &ifail);

but I am not able to compile.

Compiler gives the following error message
undefined to `__ctype_b'
/usr/local/FFC/lib/libfj9i6.so: undefined reference to `__ctype_tolower'

Please suggest me a solution.

With Kind Regards
Barani Gunasekaran
Nov 13 '05 #1
4 2407
b.***********@wbmt.tudelft.nl (Gunasekaran) wrote in
news:82*************************@posting.google.co m:
I wrote a c program and tried to call NAG(desinged for
FORTRAN)subroutine.

I called as NAG as below

d02bhf_( &x, &xend, &knor , y, &tol,&irelab, &hmax, &fcn, &g, w,
&ifail);

but I am not able to compile.

Compiler gives the following error message
undefined to `__ctype_b'
/usr/local/FFC/lib/libfj9i6.so: undefined reference to `__ctype_tolower'


Since C doesn't specify how to interface with other languages, how are we
supposed to answer this question while remaining on-topic?

--
- Mark ->
--
Nov 13 '05 #2
Gunasekaran wrote:
I wrote a C program and tried to call NAG(designed for FORTRAN)subroutine.

I called as NAG as below

d02bhf_( &x, &xend, &knor , y, &tol,&irelab, &hmax, &fcn, &g, w, &ifail);

but I am not able to compile.

Compiler gives the following error message
undefined reference to `__ctype_b'
/usr/local/FFC/lib/libfj9i6.so: undefined reference to `__ctype_tolower'


Your *link editor* couldn't find these two library functions.
You need to find the library that includes these two functions
and include the path to the library as well as the command line option
that will link in the library.

Try asking this question in the comp.lang.fortran newsgroup
and/or a newsgroup for your specific C compiler.

Nov 13 '05 #3
b.***********@wbmt.tudelft.nl (Gunasekaran) wrote:
# Dear all,
#
# I wrote a c program and tried to call NAG(desinged for FORTRAN)subroutine.
#
# I called as NAG as below
#
# d02bhf_( &x, &xend, &knor , y, &tol,&irelab, &hmax, &fcn, &g, w, &ifail);
#
# but I am not able to compile.
#
# Compiler gives the following error message
# undefined to `__ctype_b'
# /usr/local/FFC/lib/libfj9i6.so: undefined reference to `__ctype_tolower'

<ctype.h> can be macros or functions. Apparently the library expects the function
entry points but for some reason can't find them in libc. You should probably check
the libraries and entry point names. You might have to link libc before this other
library.

--
Derk Gwen http://derkgwen.250free.com/html/index.html
We found a loophole; they can't keep us out anymore.
Nov 13 '05 #4
On Thu, 28 Aug 2003 16:52:27 -0000, Derk Gwen <de******@HotPOP.com>
wrote:
b.***********@wbmt.tudelft.nl (Gunasekaran) wrote:
# Dear all,
#
# I wrote a c program and tried to call NAG(desinged for FORTRAN)subroutine. <snip> # Compiler gives the following error message
# undefined to `__ctype_b'
# /usr/local/FFC/lib/libfj9i6.so: undefined reference to `__ctype_tolower'
This is almost certainly from the linker, not the compiler; you may
not be aware of it because many (most?) compilers will run the linker
automatically for you, often by default. But in a mixed-language
situation you may need to override this behavior -- in particular, you
may need to use the C compiler to just compile (often specified by a
command line flag, conventionally -c) and then the Fortran compiler to
drive the linking.
<ctype.h> can be macros or functions. Apparently the library expects the function
entry points but for some reason can't find them in libc. You should probably check
the libraries and entry point names.
Or macros using 'hidden' data, which looks to be the case here.
You might have to link libc before this other library.


That's unlikely to help; the most common linker behavior is to search
a library only for currently unresolved symbols, so you need to
specify a library that provides a symbol *after* whatever uses it.
But the linking done automatically by the C compiler almost certainly
specifies the C library (maybe libc, maybe something else) last, so
this would not be the problem.

I suspect a more likely problem is a mismatch between the C compiler
and/or library the OP is using and that expected by the library s/he
has. Many implementations have different "modes" of various kinds --
static vs dynamic linking, threaded vs not, different memory models --
and on many platforms there are multiple C implementations (compilers
and/or libraries) available, which are not necessarily compatible with
each other. In general, whatever compiler and options were used to
compile the library, you should if possible use the same for your code
and not assume that anything else will work.

To the OP: I suggest, if the appropriate restrictions aren't obvious
in your (NAG) library, like a README or such, or on the source you got
it from, you take this to comp.lang.fortran, and tell them what NAG
you are using (or where you got it) and what C you are using with it
and with what options. The folks there are much more familiar with,
and tolerant of, C/Fortran interfacing issues, and system specifics.
Although they will probably chide you for not just using Fortran -- if
you have a good reason, state it up front to save time.

- David.Thompson1 at worldnet.att.net
Nov 13 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Asapi | last post by:
1. Are linkage convention and calling convention referring to the same thing? 2. Does calling convention differ between languages C and C++? 3. How does calling convention differ between...
8
by: Muthu | last post by:
I've read calling conventions to be the order(reverse or forward) in which the parameters are being read & understood by compilers. For ex. the following function. int Add(int p1, int p2, int...
7
by: Klaus Friese | last post by:
Hi, i'm currently working on a plugin for Adobe InDesign and i have some problems with that. I'm not really a c++ guru, maybe somebody here has an idea how to solve this. The plugin is...
5
by: Nick Flandry | last post by:
I'm running into an Invalid Cast Exception on an ASP.NET application that runs fine in my development environment (Win2K server running IIS 5) and a test environment (also Win2K server running IIS...
3
by: Mike | last post by:
Timeout Calling Web Service I am calling a .NET 1.1 web service from an aspx page. The web service can take several minutes to complete its tasks before returning a message to the aspx page. ...
2
by: Geler | last post by:
A theoretical question: Sorry if its a beginner question. Here is a quote from the MSDN explaning the C/C++ calling convention.. It demonstrates that the calling function is responsible to clean...
47
by: teju | last post by:
hi, i am trying 2 merge 2 projects into one project.One project is using c language and the other one is using c++ code. both are working very fine independently.But now i need to merge both...
7
by: =?Utf-8?B?UVNJRGV2ZWxvcGVy?= | last post by:
I have a C# logging assembly with a static constructor and methods that is called from another C# Assembly that is used as a COM interface for a VB6 Application. Ideally I need to build a file...
10
by: sulekhasweety | last post by:
Hi, the following is the definition for calling convention ,which I have seen in a text book, can anyone give a more detailed explanation in terms of ANSI - C "the requirements that a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.