473,657 Members | 2,378 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2656
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.suppor t.devtools.mac. sc++.announce
symantec.suppor t.devtools.mac. sc++.environmen t
symantec.suppor t.devtools.mac. sc++.programmer
symantec.suppor t.devtools.pc.s c++

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
3431
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 dumb example. Let's say I have a directory with the following files in it. foo.par2 foo.vol0+1.par2 foo.vol1+1.par2 zzz .par2 zzz .vol0+1.par2
2
2217
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 can use the drop-down to insert the event-handler template. But if I am not using the withevents, but instead wiring things with the addhandler command, is there a way to get the template inserted? Right now I am putting a 'dim withevents ........
2
2306
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 jumped over the lazy dogs. to The Quick Brown Fox Jumped Over the Lazy Dogs.
3
1595
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 to hardware, between a regular desktop system and one that is called a "server"? I am looking for a new server, and notice that many of the affordable "servers" cost much more than desktop units - BUT, they seem to have less in the way of memory...
2
1291
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 various combinations of single and double quotes, but I can't get it to work. What is the proper syntax. I would appreciate a straight answer- I already have the FM. Mike
0
968
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 broken. How do I get around this without adding a reference to the project itself??!! Cheers
23
4011
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 *sfun(char *); printf("%s",sfun("123"));
3
2016
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 with a form and i would like to know if using PHP will allow my website to: 1) transfer user data to a server (or email address) 2) transfer users uploaded files along with user data to a server (or email address) 3) redirect the user to a...
2
946
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
8399
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8312
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8504
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6169
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4318
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2732
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1959
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1622
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.