Author Topic: Compiling my first WPS application  (Read 43561 times)

Lars

  • Hero Member
  • *****
  • Posts: 1271
  • Karma: +65/-0
    • View Profile
Re: Compiling my first WPS application
« Reply #45 on: December 12, 2018, 11:08:09 pm »
GCC -Zomf -c hwman.cpp
If you want to compile only

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4787
  • Karma: +99/-1
    • View Profile
Re: Compiling my first WPS application
« Reply #46 on: December 12, 2018, 11:17:14 pm »
Or
gcc -Zomf -c hwman.cpp -o hwman.obj
or
gcc -Zomf -c hwman.cpp -o hwman.o

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4787
  • Karma: +99/-1
    • View Profile
Re: Compiling my first WPS application
« Reply #47 on: December 12, 2018, 11:20:57 pm »
Looking at your errors, perhaps try compiling as C by changing the codes suffix from .cpp to .c, hwman.c

Bogdan

  • Jr. Member
  • **
  • Posts: 93
  • Karma: +1/-0
    • View Profile
Re: Compiling my first WPS application
« Reply #48 on: December 13, 2018, 03:23:55 am »
Chapter 3 of the manual "Using the GNU Compiler Collection" should be mentioned regarding the file name assumptions. At least to know how it will be handled by the preprocessor and passed to the batch C compiler (cc1) or C++ compiler (cc1plus). Additionally the configuration of the gcc driver (or does FSF call it an interactive frontend?) should be checked.

Is there some OS/2 specific documentation besides emxdev.doc? So I would recommend to use this textfile that covers all build related tasks.

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4787
  • Karma: +99/-1
    • View Profile
Re: Compiling my first WPS application
« Reply #49 on: December 13, 2018, 05:20:45 am »
Is there some OS/2 specific documentation besides emxdev.doc? So I would recommend to use this textfile that covers all build related tasks.

Emxdev.doc is a good start though out of date, eg no single threading version of the library anymore. There's also the release notes etc that don't seem to be installed by yum/rpm, start here [url:http://trac.netlabs.org/libc/browser/trunk/doc] though also somewhat out of date and the netlabs pages, start at [url:http://trac.netlabs.org/libc].
Really emxdoc needs bringing up to date. Perhaps Martin could start a wiki page.

Lars

  • Hero Member
  • *****
  • Posts: 1271
  • Karma: +65/-0
    • View Profile
Re: Compiling my first WPS application
« Reply #50 on: December 13, 2018, 10:05:49 am »
Looking at your errors, perhaps try compiling as C by changing the codes suffix from .cpp to .c, hwman.c

You cannot. The file headers contain the "class" C++ keyword. A C-compiler has no clue how to handle that and what it means.
There are multiple problems with gcc, for once, I suspect that the various typedefs like SOMEXTERN etc. are not properly defined anywhere, at least not in the header files that come with gcc. If you use the toolkit headers, gcc might barf because it does not understand certain pragmas etc. etc.
Next, I seem to remember that gcc uses "C" as default calling convention and not SYSCALL (_System) as the IBM and Watcom compilers do (which is relevant for example regarding the generated symbol names), so you have to make sure that you pick the correct gcc switch to tell it to use SYSCALL calling convention.

I had also tried to use gcc in the past. gcc is good for porting UNIX programs but it is a nightmare for native OS/2 development. Is has no decent source code debugger (only a lousy command line version that gives me the creeps).

Use Watcom if you really want to get into it. That is a decent compiler and it has a GUI source code debugger. I have used Watcom for native OS/2 development and while the linker command file syntax is frightening, you will always find a good template if you look around :-)

Lars

  • Hero Member
  • *****
  • Posts: 1271
  • Karma: +65/-0
    • View Profile
Re: Compiling my first WPS application
« Reply #51 on: December 13, 2018, 12:07:05 pm »
Thanks Dave. I was running it wrong, I was able to catch the log as you told me.

1) do not use the header files from your VAC installation (\ibmcxxo\include) . Use the ones from \os2tk45\h. Make sure that CPLUS_INCLUDE_PATH points to that dir or pass this dir via the -I switch to the compiler
2) use "-fpermissive" switch for compiler
3) define "APIRET16" to be "unsigned short" or "USHORT"
4) define "_Seg16" to be nothing
5) use "-Wno-write-strings" switch for compiler

There is still other stuff that gives problems. Have fun.

Bogdan

  • Jr. Member
  • **
  • Posts: 93
  • Karma: +1/-0
    • View Profile
Re: Compiling my first WPS application
« Reply #52 on: December 13, 2018, 04:47:42 pm »
You cannot. The file headers contain the "class" C++ keyword. A C-compiler has no clue how to handle that and what it means.
Sorry, but SOM is language neutral. A C preprocessor or C compiler wouldn't use the extended headers. And there's of course no reason.

Depending on the used environment, where you can choose between the old star or CORBA, the SOM compiler
sc -sh;ih;c *.idl
produces the files that can be used with C compilation systems.

Lars

  • Hero Member
  • *****
  • Posts: 1271
  • Karma: +65/-0
    • View Profile
Re: Compiling my first WPS application
« Reply #53 on: December 13, 2018, 04:55:52 pm »
Yes, SOM is language neutral. But the generated C++ bindings are not. Or the C bindings. Or the Pascal bindings. Or the Fortran bindings.

And I used the C++ bindings.

You don't have to be sorry. You just have to think.

Bogdan

  • Jr. Member
  • **
  • Posts: 93
  • Karma: +1/-0
    • View Profile
Re: Compiling my first WPS application
« Reply #54 on: December 13, 2018, 08:09:28 pm »
Yes, SOM is language neutral. But the generated C++ bindings are not. Or the C bindings. Or the Pascal bindings. Or the Fortran bindings.
You seem to use a different version of IBM's SOMobjects. I cannot find any emitters for Pascal or Fortran. Of course you can write your emitters using the efw. Or you have to install first a third party product that offers those features. I only know of IBM's COBOL, PL/I and Smalltalk offerings that included the required support.

Idę na kolację...

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4711
  • Karma: +41/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Compiling my first WPS application
« Reply #55 on: December 13, 2018, 11:25:04 pm »

Side Note: Which is the latest "emxdev.doc" available? I had found 0.8h / 14-Dec-1993
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4787
  • Karma: +99/-1
    • View Profile
Re: Compiling my first WPS application
« Reply #56 on: December 14, 2018, 01:28:56 am »
My one is dated 21-Dec-1998. Seems to be in the http://hobbes.nmsu.edu/download/pub/os2/dev/emx/v0.9d/emxdev1.zip package along with emxlib.doc, which is also somewhat relevant for using kLIBC. http://hobbes.nmsu.edu/download/pub/os2/dev/emx/v0.9d/emxview.zip has them in INF format, which is nicer to use.
The source is in http://hobbes.nmsu.edu/download/pub/os2/dev/emx/v0.9d/emxsrcd1.zip under emx\src\doc and I guess the source code to build it is in emx\src\emxdoc while the binaries are in the regular EMX packages.
All GPLv2
edit, I don't which make was used, possibly dmake.
« Last Edit: December 14, 2018, 01:32:58 am by Dave Yeo »

Bogdan

  • Jr. Member
  • **
  • Posts: 93
  • Karma: +1/-0
    • View Profile
Re: Compiling my first WPS application
« Reply #57 on: December 14, 2018, 01:47:55 am »
Dave is fast and right. Nothing much to add.

A second source: https://sourceforge.net/projects/emx/rss?path=/emx/0.9d-fix04 (official)

And emxdoc can not only generate IPF but also HTML.

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4711
  • Karma: +41/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Compiling my first WPS application
« Reply #58 on: December 21, 2018, 04:04:42 pm »
Hi

I had wrote this quick article about my experience compiling HWMan.
It is located here: http://www.edm2.com/index.php/Compiling_HWMan_WPS_Class_on_ArcaOS_5.x

Constructive criticism and spell/grammar check are always welcome.

Regards
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Pete

  • Hero Member
  • *****
  • Posts: 1281
  • Karma: +9/-0
    • View Profile
Re: Compiling my first WPS application
« Reply #59 on: December 21, 2018, 07:06:16 pm »
Hi All

Having followed this thread and seen the hoops "c" programmers have to jump through to accomplish anything I am glad that I decided to use WDSibyl as my choice of occasional development tool/app.

Good luck to all you "c" programmers  :-)


Regards

Pete