473,396 Members | 1,849 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,396 software developers and data experts.

undefined symbol in module *.c

hello,

I'm trying to write a C program that calls a function that written in
assembly language(X86), but I keeps getting undefined error. I used
paradigm C++ for linking and compiling.

------------------------------------------------------------
;this is output.asm

name output
..186
..MODEL small, c

assume cs: _TEXT
_TEXT segment public 'CODE'
public _output_word
_output_word proc C NEAR

push ax
push dx
push bp ; saves base pointer
mov bp, sp ; base pointer gets stack pointer
mov dx, [bp+4] ; moves port address to dx
mov ax, [bp+6] ; moves data to ax
out dx, ax
pop bp
pop dx
pop ax
ret

_output_word endp

_TEXT ends
end
---------------------------------------------------------------
//this is ccode.c

#define T2CON 0x1000
#define T2_Mode 0xC001

extern void output_word(int port_address, unsigned short data);

void main(void)
{
while(1)
{
output_word(T2CON, T2_Mode);
}

}
---------------------------------------------------------------------
The error message is as follows:

Info :Linking N:\ese476\C Phase 1\cphase1.rom
Warn : :Old-style user-defined stack - stack options ignored
Error: ccode.c(4): Undefined symbol _output_word in module ccode
Warn : :Program has no entry point

both files are compiled and assembled under one project and under .axe
files. both files passed the compiler and assembler, but error when I
tried to link them.
any help will be appreciated!
Thanks
-V-
Jul 19 '05 #1
3 6332
Victor wrote:
hello,

I'm trying to write a C program that calls a function that written in
assembly language(X86),
C, assembly... What makes you think your question is topical on a group
that discusses C++?

For the record, neither C nor C++ define a standard way of calling a
piece of code written in assembly language. You need to ask on a group
that discusses your particular implementation.

http://www.slack.net/~shiva/welcome.txt
http://www.slack.net/~shiva/offtopic.txt

<snip>

#define T2CON 0x1000
#define T2_Mode 0xC001

extern void output_word(int port_address, unsigned short data);

void main(void)


In C and C++, main returns int. void is not and never has been an
acceptable return type for main.

-Kevin
--
My email address is valid, but changes periodically.
To contact me please use the address from a recent posting.

Jul 19 '05 #2
Victor wrote:


extern void output_word(int port_address, unsigned short data);


extern "C" void output_word(int port_address, unsigned short data);

That will tell the compiler that output_word should be called as if it
were a C function. That will make it easier to match the name mangling.

--

Pete Becker
Dinkumware, Ltd. (http://www.dinkumware.com)
Jul 19 '05 #3
okay, sorry, it's just when I search for this error, lots of other ppl
were posting on this newsgroup. So , sorry, won't repeat it again.

I tried to include "C" on the declaration, but it gave me declaration
terminated incorrectly.
anyway, sorry, I"m gonna post this in the asm newsgroup.

thanks
-V-
Jul 19 '05 #4

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

Similar topics

1
by: Stu | last post by:
I am trying to build the xerces shared library with 2.3.0 version of their source code on an AIX 5.1 32 bit machine with the following version of the g++ compiler /usr/local/bin/g++ -v Reading...
3
by: ch424 | last post by:
Hi there, I'm using Python 2.4.1 on Ubuntu Linux, and I'm having problems extending python in C: The C code is below: #include <Python.h> #include "ni488.h"
8
by: Scott J. McCaughrin | last post by:
The following program compiles fine but elicits this message from the linker: "undefined reference to VarArray::funct" and thus fails. It seems to behave as if the static data-member:...
2
by: Simon Newton | last post by:
Hi, I've just starting out embedding Python in C and get the following error when I try and import a module that in turn imports the math module. ImportError:...
8
by: pavan734 | last post by:
Hello, Please excuse me as Iam not posting this to correct group. I have a parser code obtained from flex command. I have many other files. When I compile them Iam getting a message like:...
1
by: yamitmehta | last post by:
When I compile to code using g++arm of VxWorks 5.5 and put it on my board i get the follwing undefined symbols:- Cpool and Csingleton are template classes. CPool has the static member...
1
by: Justin Johnson | last post by:
Hello, I'm trying to build Python 2.5.0 on AIX 5.3 using IBM's compiler (VisualAge C++ Professional / C for AIX Compiler, Version 6). I run configure and make, but makes fails with undefined...
1
by: vsen123 | last post by:
Hi, I wanted to use multiple source files for one program.I created a file "key.h" as follows: #ifndef KEY_H #define KEY_H class Inputk { int hkey; char Kuser; protected: int Key;
1
by: grbgooglefan | last post by:
I am importing cStringIO module in my PythonC++ embedded program. The import is failing with the following error: ImportError: /usr/lib/python2.3/lib-dynload/cStringIO.so: undefined symbol:...
1
by: Borse, Ganesh | last post by:
Hi, Can you please guide me for the following problem? The call to "PyImport_ImportModule("cStringIO");" is failing with an error of "undefined symbol: PyObject_SelfIter". Before importing this...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.