News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Are working libraries?

Started by HSE, November 23, 2020, 07:13:01 AM

Previous topic - Next topic

HSE

Hi Biterider!!

I have this little problem:TdiChilds.lib(TdiChilds.obj) : error LNK2005: _TPL_OA_Primer already defined in list.obj

I tried to see if other code (from previous version) is working, but I can't (easily  :biggrin:):
I01_Main.inc(171) : Error A2056: Symbol already defined: _OnSize

Last week I noted the problem is solved replacing:

VirtualEvent OnSize, WM_SIZE
by
    if TARGET_BITNESS eq 32
    RedefineMethod    OnSize,         WPARAM, LPARAM
    else
  VirtualEvent      OnSize,         WM_SIZE
  endif


Now look like there is a problem in last version.

Thanks in advance. HSE

Equations in Assembly: SmplMath

Biterider

Hi HSE
Can you send me your current code (by email)?
I had no problem compiling the code from this thread.

Could it be that an ancestor was accidentally changed?

Biterider

HSE

Quote from: Biterider on November 23, 2020, 07:52:56 AM
I had no problem compiling the code from this thread.
:biggrin:

I will make a test  :thumbsup:

The problem perhaps is only in 32 bits.

Thanks.
Equations in Assembly: SmplMath

HSE

#3
Hi Biterider!

Apparently Nemesis is sleeping and don't want emails  :biggrin:

Not tested now but "  RedefineMethod    OnSize,         WPARAM, LPARAM"  failed in 64bit machine.

TdiDemo2 is using a library, same construction don't have problems previously. See log file.

Regards.

PD: Destroy destroyed after reading  :cool:
Equations in Assembly: SmplMath

Biterider

Hi HSE
I changed the TdiChilds.asm file a little and added MakeObject.cmd to make compilation easier.
You may need to change some paths on your system.

After compiling TdiChilds, I was able to compile the main app (32 bit, wide strings).
If you want to change the compilation targets, you need to change the path to the .cop file in TdiChilds.asm.

Regards, Biterider

HSE

Hi Biterider!

Perfect  :thumbsup:

:biggrin: I found here MakeMyObjects.cmd. Long time without making something big in OA Fusion, I forgot totally that part.

Thanks very much, HSE
Equations in Assembly: SmplMath

HSE

Hi Biterider!

I really don't like very much your new notation for libraries, I very used to ObjAsm32  :biggrin: , and with around 40°C is nice to stay in the shadow!!

To build libraries don't show any problem if writing:
Code (TdiChilds.asm) Select
% include @Environ(OBJASM_PATH)\Code\Macros\Model.inc   ;Include & initialize standard modules
SysSetup OOP, LIB32, WIDE_STRING;, DEBUG(WND)            ;Load OOP files and OS related objects

% include &MacPath&DlgTmpl.inc
% include &IncPath&Windows\CommCtrl.inc
% include &IncPath&Windows\winuser.inc

;Add here all files that build the inheritance path and referenced objects

LoadObjects Primer, Stream
LoadObjects WinPrimer, Window
LoadObjects SimpleImageList, MaskedImageList
LoadObjects MsgInterceptor, WinControl, Toolbar


With very little modifications :
Code (in SysSetup of Model.inc) Select

  .nolist
  .nocref

  % include &IncPath&Windows\Windows.inc
  % include &MacPath&System.inc
  % include &MacPath&Memory.inc
  % include &MacPath&Strings.inc
  % include &MacPath&WinHelpers.inc
  % include &MacPath&ConstDiv.inc
  % include &IncPath&ObjAsm\ObjMem.inc
  ife TARGET_BIN_FORMAT eq BIN_FORMAT_LIB        ;;          <------------------
      % includelib &LibPath&Windows\GDI32.lib
      % includelib &LibPath&Windows\Kernel32.lib
      % includelib &LibPath&Windows\User32.lib
      % includelib &LibPath&Windows\Advapi32.lib
      if TARGET_BITNESS eq 32
        % includelib &LibPath&ObjAsm\ObjMem32.lib
      else
        % includelib &LibPath&ObjAsm\ObjMem64.lib
      endif
  else
      TARGET_LIBRARY = 1
  endif 

  .list
  .cref

  externdef hInstance:HINSTANCE                         ;;Export hInstance symbol
  ife TARGET_BIN_FORMAT eq BIN_FORMAT_LIB    ;;     <------------------
      externdef hProcessHeap:HANDLE                         ;;Export hProcessHeap symbol
      externdef p1stOMD:POINTER                             ;;Export p1stOMD symbol
  endif 
  ;;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

  if TARGET_USER_INTERFACE eq USER_INTERFACE_NONE
    echo User Interface: NONE
  elseif TARGET_USER_INTERFACE eq USER_INTERFACE_WIN
    echo User Interface: WINDOW
  endif

  if TARGET_BIN_FORMAT eq BIN_FORMAT_EXE
    echo Binary Format:  EXE
  elseif TARGET_BIN_FORMAT eq BIN_FORMAT_DLL
    echo Binary Format:  DLL
  elseif TARGET_BIN_FORMAT eq BIN_FORMAT_LIB
    echo Binary Format:  LIB
    IMPLEMENT         = FALSE                           ;;Don't implement unless MakeObject is used
    MAKETEMPL         = FALSE                           ;;Don't create any object template
    SHOWINHERITANCE   = FALSE                           ;;Don't output the inheritance path
  endif

  if TARGET_BITNESS eq 32
    echo Bitness:        32
  else
    echo Bitness:        64
  endif

  if TARGET_OOP eq OOP_ENABLED
    echo OOP Support:    ENABLED
    % include &MacPath&Objects.inc                      ;;Here is our OOP support! => ObjAsm

    if DEBUGGING
      S_OBJID segment                                   ;;Define a new segment
        ??ObjIDTableStart equ $                         
      S_OBJID ends                                      ;;Switch back to previous segment
      ??ObjIDTableCount = 0                             
                                                       
      S_OBJERR segment                                  ;;Define a new segment
        ??ObjErrTableStart equ $                       
      S_OBJERR ends                                     ;;Switch back to previous segment
      ??ObjErrTableCount = 0

    endif
      if TARGET_BIN_FORMAT eq BIN_FORMAT_LIB   ;;    <------------------
        IMPLEMENT         = FALSE                           ;;Don't implement unless MakeObject is used
        MAKETEMPL         = FALSE                           ;;Don't create any object template
        SHOWINHERITANCE   = FALSE                           ;;Don't output the inheritance path
      endif

    % include &ObjPath&ObjIDs.inc                       ;;These include files must follow the
    % include &ObjPath&ObjErrs.inc                      ;;  previous segment definitions

  else
    echo OOP Support:    DISABLED
    IMPLEMENT         = FALSE                           ;;Don't implement unless MakeObject is used
    MAKETEMPL         = FALSE                           ;;Don't create any object template
    SHOWINHERITANCE   = FALSE                           ;;Don't output the inheritance path
  endif


Code (in Objects.inc) Select
LoadObjects macro FileNameList:vararg
  for $$FileName:req, <FileNameList>
    IMPLEMENT = FALSE
    if @InStr(1, $$FileName, <\>) eq 0
      $$IncObjPath textequ <&ObjPath&>
      if TARGET_STR_TYPE eq STR_TYPE_ANSI
        $$LibObjPath catstr <&ObjPath&>, <Lib\>, %TARGET_BITNESS, <A\>
      else
        $$LibObjPath catstr <&ObjPath&>, <Lib\>, %TARGET_BITNESS, <W\>
      endif
    else
      $$IncObjPath textequ <>
      $$LibObjPath textequ <>
    endif
    %include &$$IncObjPath&&$$FileName&.inc
    ifdef TARGET_LIBRARY        ;;   <------------------
        ife TARGET_LIBRARY eq 1
          %includelib &$$LibObjPath&&$$FileName&.lib   
        endif
    else
        %includelib &$$LibObjPath&&$$FileName&.lib   
    endif
  endm
  ifdef TARGET_LIBRARY          ;;   <------------------
   ife TARGET_LIBRARY eq 1
     IMPLEMENT = TRUE                                      ;;Set default
   endif
  else
    IMPLEMENT = TRUE                                      ;;Set default
  endif   
endm


Of course must be tested more, and for sure can be improved.

Regards. HSE
Equations in Assembly: SmplMath

Biterider

Hi HSE
I've looked at your changes and I think I've understood that you want to further automate and simplify the library compilation process. I will analyze the proposal in more depth.
What I don't understand is what you mean with "your new notation for libraries, I very used to ObjAsm32". What has changed? Can you elaborate it a bit more?
Any help is appreciated.  :biggrin:

Biterider


PS: can you send me or post the files to make a diff? That way, it's easier to see the changes.

HSE

Quote from: Biterider on November 25, 2020, 05:42:24 AM
What I don't understand is what you mean with "your new notation for libraries, I very used to ObjAsm32". What has changed?
:biggrin:  Ok, perhaps it's not new. To make libraries in ObjAsm32 I always used SysSetup and LoadObjects, not even know .cop files (now I see there is one) and the use of full paths in .cmd files "it's a mistery"  :biggrin:.

Now is working like always I do in ObjAsm32:asmc28 /coff TdiChilds.asm
lib TdiChilds.obj


Equations in Assembly: SmplMath

Biterider

Hi HSE
OK then let's demystify it.  :biggrin:

These .cop files (Common OPtions) are a set of settings and include files for each of the 4 compilation targets in the \ObjAsm\Code\Objects\Lib directory.
These are 32A, 32W, 64A and 64W. In each of these subdirs is a different .cop file.
If you are compiling for either of these targets, you only need to use the files from one of these directories.

The idea of using .cop files was already there in ObjAsm32 (ObjMem32.cop) and I continued to use this concept in the Fusion project. By the way, ObjMem.cop currently also present.

The reason I used full paths in the MakeObject.cmd file I sent you is because it was a sort of quick solution. I could use the standard framework paths as well.

I'll review your changes this weekend when I have a little more time.

Regards, Biterider





HSE

Equations in Assembly: SmplMath

Biterider

Hi HSE
I now understand what you mean. I had to go back to the ObjAsm32 V1.6 sources to find that I accidentally took a different way when compiling objects in C.1.1.
Version C.1.0 was not yet able to precompile objects.

Fortunately, going back isn't a big deal.

Thank you for pointing it out.  :thumbsup:

Biterider

HSE

Equations in Assembly: SmplMath

Biterider

Hello HSE
Yesterday I got the change on SysSetup working again like it was in ObjAsm32.  :tongue:
In the "Object".asm files I left the .cop files and updated their content. The reason is that I have to choose the right one according to the compilation targets.
If you're compiling your own object, you can replace the .cop file with the usual SysSetup declaration and select the right targets.
I added a file called MakeMyObject.cmd to the attachment to make the compilation process easier.

I had to modify many of the "object".asm files to replace the includes with the LoadObjects macro.
I pushed this update to the Github repository at https://github.com/ObjAsm/ObjAsm-C.1  :icon_idea:

The question remains whether I should rename the .cop files or leave them as they are.
The nice thing about them is that they are easy to find.

Regards, Biterider

HSE

Hi Biterider!

Quote from: Biterider on November 30, 2020, 05:53:39 PM
Yesterday I got the change on SysSetup working again like it was in ObjAsm32.  :tongue:
...
I pushed this update to the Github repository at https://github.com/ObjAsm/ObjAsm-C.1  :icon_idea:
Is working perfectly  :thumbsup:

Quote from: Biterider on November 30, 2020, 05:53:39 PM
In the "Object".asm files I left the .cop files and updated their content. The reason is that I have to choose the right one according to the compilation targets.
...
The question remains whether I should rename the .cop files or leave them as they are.
The nice thing about them is that they are easy to find.
Perhaps .cop are better. I don't know. Just is nice SysSetup  :biggrin:
And I don't see any problem in to conserve or even develop .cop system.

Quote from: Biterider on November 30, 2020, 05:53:39 PM
I had to modify many of the "object".asm files to replace the includes with the LoadObjects macro.
I think that is unnecesary. Package libs are builded with MakeObjects_x_x.cmd, very very infrequently, perhaps just once time.   

Thanks. HSE
Equations in Assembly: SmplMath