Menu

Hello there!

2020-09-22
2020-09-28
  • Dmitry Kirichenko

    Suprised to see this project still alive. I have some questions about building and using Portable Object Compiler on Win32 with Open Watcom 1.9.

    First thing, when i tried to build latest version 3.3.20 (using old version 3.1.9 from 2000 year) i got two errors about undeclared symbols OBJCVERSION and OBJC1VERSION while building objc. I've solved this by adding two defines in config.h file:

    #define OBJCVERSION "3.3.20"
    #define OBJC1VERSION "3.3.20"
    

    Second, when including both windows.h and objpak.h in my programs typedef BOOL in objcrt.h conflicts with one from Windows API. I've solved this by redefining BOOL to OCBOOL before including any object compiler headers and then undefining it. It's okay or there is better way to do with that?

    Third, when creating blocks in code they will be allocated as new instance every time! It adds many troubles using blocks without garbage collection, each block must have be assigned to a variable and freed when not need anymore. Shouldn't blocks be literals, i.e. created once when program starts and then returning always same instance in declarations?

    And last question is about reference counting. I tried compiling my program with -refcnt option in hope to use blocks without freeing it each time, and it fails because objcrtr.lib and objpakr.lib were not found. I tried compiling these libraries adding #define OBJC_REFCNT 1 to config.h, recompiling objcrt and objpak, and renaming results to objcrtr.lib and objpakr.lib respectively. My program then compiles with -refcnt options, but crashes with access violation on startup. How do i get this option to work properly?

     
  • Dmitry Kirichenko

    Okay I realized it was stupid to modify config.h for compilation of objcrtr.lib and objpakr.lib, much better idea is add an '-refcnt' switch into Makefile on these libraries. My program then starts normally, but stll fail in some cases, like

    int main(int argc, char *argv[])
    {
        id someblock = { printf("addr = %p", someblock); };
        [someblock value];
    
        return 0;
    }
    

    results an error "error: Message 'decrefs' sent to freed object."

     
  • David Stes

    David Stes - 2020-09-26

    Hello Dmitry,
    Thanks for the feedback. I've updated the zip package for the Waterloo Compiler (WATCOM) to version 3.3.20 . The WATCOM compiler is a nice compiler, I hope they update it for x64 ... I had no real issues (short of the update that you reported of the version number) when building on Microsoft Windows 10 64-bit.
    Regarding other issues, it all depends on whether other people have use for those options. Some options like -otb (double reference to Objects for heap compaction) and -inlinecache I rarely use, so yes there's no doubtlessly bugs in there.
    Regards, and best, David Stes

     
  • Dmitry Kirichenko

    Hello David. Yea, WATCOM for x64 would be nice. Thank you very much for updated version.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.