Operating System - HP-UX
1748256 Members
3693 Online
108760 Solutions
New Discussion

Re: aC++ compiling functions with $ in name

 
SOLVED
Go to solution
Christopher Bland
New Member

aC++ compiling functions with $ in name

I am very new to the HP-UX environment, so if this question is completely off-base I apologize in advance.

I am using HP aC++/ANSI C B3910B A.05.38 [Sep 12 2002] on HP-UX B.11.22 U ia64. I am compiling a C++ file which includes a header file as a wrapper for my C++ to Fortran functions. In my header file, for example, I have:

extern "C" void m$myfunc_ (int& myint);
void m_myfunc (int& myint)
{
m$myfunc_(myint);
}

When I compile the file I get an Error 92, it doesn't like the '$' character.

I had a similar problem with Solaris C++ v5.3 and solved it by adding the '-Xm' flag. I found a nice document on HP's site comparing the Solaris C++ to aC++ but there was no corresponding flag for '-Xm' to allow the '$' character.

Does anyone know a workaround to this, am I missing something, or is this a total loss? It is not possible for me to remove the '$' references because it is throughout my Fortran code (and there is a lot).

I appreciate any help that anyone can give. Please let me know if there is any other information needed that I failed to provide.
4 REPLIES 4
Steve Steel
Honored Contributor
Solution

Re: aC++ compiling functions with $ in name

Hi


http://h21007.www2.hp.com/dspp/tech/tech_TechSoftwareDetailPage_IDX/1,1703,1743,00.html

Get the latest compiler

This was fixed for pa-risc in the new

HP-UX 11i v1.6 (B.11.22) (for Itanium® 2-based systems)

Compiler Version A.05.55 HP C Available in January 2004 as Patch PHSS_30023
» PHSS_30023


patch fix list



» PHSS_30024


u2comp/be patch patch

» PHSS_30211


linker cumulative patch

» PHSS_30212


libm cumulative patch

» PHSS_28975


milli.a cumulative patch

» PHSS_30125


unwind library cumulative patch
You must already have A.05.36 installed in order to install PHSS_30023.

PHSS_30023 has many defect fixes for HP-UX 11i v1.6 (B.11.22) release and supports new features.

PHSS_30024 is only needed for +O4 (or +O3 for libm inlining) and the new -ipo option.

PHSS_30024 also requires PHSS_30211.

Compiler Version A.05.55 for HP aC++ Available in January 2004 as Patch PHSS_30022
» PHSS_30022

» patch fix list
» PHSS_30210


aC++ runtime patch

» PHSS_30024

u2comp/be patch

» PHSS_30211

linker cumulative patch

» PHSS_30212

libm cumulative patch

» PHSS_28975

milli.a cumulative patch

» PHSS_30215

unwind cumulative patch
You must already have A.05.36 installed in order to install PHSS_28977.

PHSS_30022 has many defect fixes for HP-UX 11i v1.6 (B.11.22) release.

PHSS_30024 is only needed for +O4 (or +O3 for libm inlining) and the new -ipo option.

PHSS_30024 also requires PHSS_30211.

PHSS_30210 fixes several memory leaks. Installing PHSS_30210 may require installing the latest gdb to handle a demangling change.

PHSS_30215 is needed to fix a memory leak on throw.

The librwtool runtime library matches Rogue Wave Version 7.0.6.

The libstd runtime library matches Rogue Wave Version 1.2.1.

The libstd_v2 runtime library matches Rogue Wave Version 2.02.01.

If you want truly to understand something, try to change it. (Kurt Lewin)
Christopher Bland
New Member

Re: aC++ compiling functions with $ in name

Thanks a lot for the reply. I apologize for not realizing this prior to posting. The sad thing is I actually saw this patch but did not understand the details. I am installing it now and will see how it goes. Thank you again for your help.
Christopher Bland
New Member

Re: aC++ compiling functions with $ in name

I updated my compiler yet I am still having a problem. I patched aC++ to V05.55. Is there some compiler flag I should be passing through or another bundle kit installed?

Here is my test program with output:

mytest.cc
#include
using namespace std;

int main();
void m$testm();

int main()
{
cout << "Hello World from C++!" << endl;
m$testm();
return 1;
}

void m$testm()
{
cout << "Hello World from m$testm" << endl;
}

Output:
Error 92: "mytest.cc", line 5 # Character '$' (value 36) was unexpected.
void m$testm();
^
Error 92: "mytest.cc", line 10 # Character '$' (value 36) was unexpected.
m$testm();
^
Error 20: "mytest.cc", line 5 # '' expected before ')'.
void m$testm();
^
Error 452: "mytest.cc", line 5 # Objects may not have void type.
void m$testm();
^
Error 19: "mytest.cc", line 9 # Unexpected ';'.
cout << "Hello World from C++!" << endl;
^
Error 224: "mytest.cc", line 9 # Arguments do not match with any function 'endl'.
cout << "Hello World from C++!" << endl;
^^^^^
Error 92: "mytest.cc", line 15 # Character '$' (value 36) was unexpected.
void m$testm()
^
Error 20: "mytest.cc", line 15 # '' expected before ')'.
void m$testm()
^
Error 173: "mytest.cc", line 15 # Redefined symbol ''; previously defined at ["mytest.cc", line 5].
void m$testm()
^
Error 452: "mytest.cc", line 15 # Objects may not have void type.
void m$testm()
^
Error 24: "mytest.cc", line 16 # ',' expected instead of '{'.
{
^
Error 452: "mytest.cc", line 17 # Objects may not have void type.
cout << "Hello World from m$testm" << endl;
^^^^
Error 699: "mytest.cc", line 17 # Error limit reached; halting compilation.
cout << "Hello World from m$testm" << endl;
^^^^
I am fairly confident that the other errors will go away once the '$' issue is resolved. Thanks for any help you can give.
Dennis Handly
Acclaimed Contributor

Re: aC++ compiling functions with $ in name

>I patched aC++ to A.05.55. Is there some compiler flag I should be passing through?

 

If you are on aCC3 or aCC5, you must pass in -ext.  For aCC6 and PA HP C, it's enabled by default.