473,402 Members | 2,055 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,402 software developers and data experts.

Dumb Symantec C++ question

Ok, I've wasted two days trying to figure this out.

I'm stuck using Symantec C++ 7.5 on this one project.
I'd port it over to something more recent, but time is pressing...

I need to move some functions out to another file,
compile them separately, then link the whole shebang back together.

Good old C++ name mangling is getting in the way.
I tried "_cdecl" in the function bodies, the compiler accepts it, but no go,
names still are mangled.

I tried "extern "C"" in the declarations, this seems to work.

But I still can't export the actual code with the simple unmangled name!

Of course the Symantec C on-line help doesnt even mention _cdecl
or anythijng similar.

Any hints appreciated!!
Jul 19 '05 #1
6 2639
Can you be more specific about what you are trying to do ? If both files
are being compiled with C++, then the linker should have no problem.
Provide some more details and I should be able to help you out. Provide the
function signatures and file names.
"George R. Gonzalez" <gr*@umn.edu> wrote in message
news:bj**********@lenny.tc.umn.edu...
Ok, I've wasted two days trying to figure this out.

I'm stuck using Symantec C++ 7.5 on this one project.
I'd port it over to something more recent, but time is pressing...

I need to move some functions out to another file,
compile them separately, then link the whole shebang back together.

Good old C++ name mangling is getting in the way.
I tried "_cdecl" in the function bodies, the compiler accepts it, but no go, names still are mangled.

I tried "extern "C"" in the declarations, this seems to work.

But I still can't export the actual code with the simple unmangled name!

Of course the Symantec C on-line help doesnt even mention _cdecl
or anythijng similar.

Any hints appreciated!!

Jul 19 '05 #2
Kris Wempa wrote:
Can you be more specific about what you are trying to do ?


Please don't top-post. Re-read section 5 of the FAQ for posting guidelines.

http://www.parashift.com/c++-faq-lite/

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

Jul 19 '05 #3

Ok, I didnt describe things too clearly the first time.

The problem is this program is calling a few functions that normally live in
a DLL

Those functions havent a chance of running on MY PC, as they expect some
really weird I/O box plugged into the bus.

Soooo, I want to write some little stubs that print out: "OSC_FREQ called
with param: ####", and so on.

The functions are normally declared as : extern "C" VB_CODE FAR PASCAL
OSC_FREQ( yadda, ... );

I have my stubs declared as: extern "C" VB_CODE OSC_FREQ( yadda, ... );

(This generates a call to _OSC_FREQ() )
( "VB_CODE" is a enum type )

In my separate file of stubs, how the heck do I declare the functions?

As I've noted, this brain-dead compiler accepts and IGNORES "cdecl"
"_cdecl", .. Ick.
Thanks,

George

Jul 19 '05 #4
George R. Gonzalez wrote:
Ok, I didnt describe things too clearly the first time.

The problem is this program is calling a few functions that normally live in
a DLL


I kind of suspected this would deal with DLLs. I'm afraid you are on the
wrong group. Try a Windows programming group. This group only discusses
the Standard C++ language, which does not include DLLs. Please read the
welcome message for a list of groups you might try, as well as
information about topicality in comp.lang.c++:

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

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

Jul 19 '05 #5
George R. Gonzalez wrote:
Good old C++ name mangling is getting in the way.

I tried "_cdecl" in the function bodies, the compiler accepts it, but no go,
names still are mangled.

I tried "extern "C"" in the declarations, this seems to work.

I don't know symantec (this is the wrong newsgroup). But I've seen
linkage problems :-). The following has worked wonders after stupid
mistakes,
% rm *.o
% make
That is, delete all object files and build everything from scratch.

Or, to see what symbols are actually present present in an object file,
% nm -a foo.o
Ideally, the symbol in question gets defined in exactly one object, and
you have it undefined in zero or more other files.

You might get more specific help here if you posted a minimal compilable
code that exhibits the problem. Or you could try a more focused group;
I see, e.g.,
symantec.support.devtools.mac.sc++.announce
symantec.support.devtools.mac.sc++.environment
symantec.support.devtools.mac.sc++.programmer
symantec.support.devtools.pc.sc++

Christian

Jul 19 '05 #6

"George R. Gonzalez" <gr*@umn.edu> wrote in message
news:bj**********@lenny.tc.umn.edu...
The problem is this program is calling a few functions that normally live in a DLL

Those functions havent a chance of running on MY PC, as they expect some
really weird I/O box plugged into the bus.

Soooo, I want to write some little stubs that print out: "OSC_FREQ called
with param: ####", and so on.

The functions are normally declared as : extern "C" VB_CODE FAR PASCAL
OSC_FREQ( yadda, ... );
Far pascal? Does that mean your DLL is written in 16 bit code? If so, you
cannot connect to 16 bit code using a 32 bit memory model. You'll need to
use a 16 bit memory model. If that is the case, a declaration that is likely
to work would be:

extern "C" VB_CODE __far __pascal OSC_FREQ(yadda, ...);
I have my stubs declared as: extern "C" VB_CODE OSC_FREQ( yadda, ... );

(This generates a call to _OSC_FREQ() )
( "VB_CODE" is a enum type )

In my separate file of stubs, how the heck do I declare the functions?

As I've noted, this brain-dead compiler accepts and IGNORES "cdecl"
"_cdecl", .. Ick.


If you want to check the names produced by the compiler, run OBJ2ASM over
the resulting .obj file. But it looks to me like you'll need to declare it
as __far __pascal, not __cdecl. I don't think it is ignoring __cdecl, as
_OSC_FREQ is the correct C name mangling (which is prepending an "_").
Jul 19 '05 #7

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

Similar topics

4
by: Python Dunce | last post by:
I've run into an issue with glob and matching filenames with brackets '' in them. The problem comes when I'm using part of such a filename as the path I'm passing to glob. Here's a trimmed down...
2
by: Marcus Smaby | last post by:
With the rich IDE on VB.net 2003, I was wondering if there is an easy way to set the event handler function for a hand-coded object (SqlConnection for example). I know that if I dim it withevents I...
2
by: Mark Healey | last post by:
I'm trying to craft a search that capitalizes letters depending on their context, specifically after a space or the beginning of a string. For example I'd like to turn the quick brown fox...
3
by: MostlyH2O | last post by:
Hi Folks, I'm sorry if this is the wrong place to ask a really newbie question, but I can't seem to get an answer to what seems to be a simple question... What is the difference, with regard...
2
by: | last post by:
Hi, I apologize for my ignorance. I'm trying to execute a GRANT statement giving select to user@host-host.domainname. Mysql doesn't like the dash in the hostname, or the dots in an ip. I tried...
0
by: Duncan Mole | last post by:
Hi, I know this is dumb but if I add a reference to the release version of a company class library in debug and build it it works fine. If I then switch to release and rebuild the reference is...
23
by: David Frank | last post by:
How can I write a string function that encloses the input string in quotes "string" ?? below works for the "123 operation but adding " to it clobbers the "123 main() { char...
3
chunk1978
by: chunk1978 | last post by:
hi there... totally new to PHP... please forgive my ignorance... i've done some reading about PHP and it seems to be what i'm looking for... but i'm still not convinced... i'm creating a website...
2
by: Steven W. Orr | last post by:
So sorry because I know I'm doing something wrong. 574 cat c2.py #! /usr/local/bin/python2.4 def inc(jj): def dummy(): jj = jj + 1 return jj return dummy
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
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?
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.