gfxgfx
 
Please login or register.

Login with username, password and session length
 
gfx gfx
gfx
1566 Posts in 517 Topics by 752 Members - Latest Member: zaikunzhang October 28, 2021, 02:05:19 AM
*
gfx* Home | Help | Search | Login | Register | gfx
gfx
Absoft User Forum  |  Support  |  Windows  |  Include File Question
gfx
gfxgfx
 

Author Topic: Include File Question  (Read 2275 times)

Gene

  • Jr. Member
  • **
  • Posts: 56
Include File Question
« on: August 05, 2013, 09:45:23 PM »
Attached is an C code Include File; which works fine compiling under Absoft7.5 interface which uses Absoft Fortran and C compilers.  Include File is for SuperPlot plotting program add-on

However, when I try to use this Include file under Absoft 2012 and Microsoft C/C++ 2010 Express; it aborts on an error; given as occurring at Line #6; error is related to 'string'  Nothing else is mentioned for errors.

Any thoughts on why this error is occurring??

Thanks for any feedback on this....


forumadmin

  • Administrator
  • Sr. Member
  • *****
  • Posts: 320
Re: Include File Question
« Reply #1 on: August 06, 2013, 07:37:34 AM »
The extern "C" {    } construct which begins on line 6 of this file is part  of the C++ language but not
included in the standard C language. The construct is used to prevent the compiler from applying C++
name mangling to the function prototypes enclosed in the braces. 

The Microsoft VS 2010 compiler does not accept this construct when compiling in C language mode.
You have two choices:

1) Put the compiler into C++ mode by using the /TP (compile all source as C++) or the
    /Tp<source file> (compile source file as C++) option, or by changing your source
    file extension to .cpp

2) Delete or comment out line 6 and line 248 to remove the construct
    as it is not needed when compiling in C language mode.

If you choose to compile in C++ mode, you will also need to add int type specifiers to the first three
arguments in the prototype on line 194, changing that line from

     DllImport int spAddRasterData(const graph_handle, const nx, const ny, double * x
           , double * y, double ** data);

to this

     DllImport int spAddRasterData(const int graph_handle, const int nx, const int ny, double * x
           , double * y, double ** data);

as the Microsoft compiler does not support default-int specifiers in C++ mode.

Gene

  • Jr. Member
  • **
  • Posts: 56
Re: Include File Question
« Reply #2 on: August 06, 2013, 10:08:37 AM »
Thanks, the feedback is appreciated.

I tried both options mentioned; each one opened up a whole host of other cascading errors in the project.

The mixed language project compiles fine in the Absoft 70 system; so I will keep this project under Absoft 70.  I had hoped to easily convert it to Absoft 2012 but appears to be more effort than warranted to do so....

Best regards

Absoft User Forum  |  Support  |  Windows  |  Include File Question
 

gfxgfx
gfx gfx
Powered by MySQL Powered by PHP Valid XHTML 1.0! Valid CSS!