Register | Login
Forum Index > General Discussion > error linking coff obj file
Author Message
Pages: 1 2
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[1401] error linking coff obj file - posted: 2014-04-18 14:11:13
Hi Mr Colin,

i have this code
Code:
program MSCOFF  'test';

#define APPTYPE_CUI;

#include 'win_def.zir';
#Include 'console.zir';

function  H_strcpy(Dword dst, src)
{ 
  uses edx ebx;
  Eax = dst; 
  Edx = src; 
  push Eax;
  BL = char[Edx];
  while ( BL != 0)  
   {
      char[Eax] = BL; 
      Eax++; Edx++; 
      BL =  char[Edx]; 
   }
  char[Eax] = 0;
  pop Eax;
}


so when linking with ld linker i got that

undefined reference to `_H_strcpy'



http://www.freewebs.com/ogremagic/index.htm
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1402] - posted: 2014-04-21 12:33:40
I have just tested with the Microsoft Incremental Linker and it linked fine.

my batch file:

Code:
Ziron.exe "DIR\sample.zir"

link.exe /SUBSYSTEM:windows /ENTRY:entry user32.lib kernel32.lib sample.obj

pause


happy easter btw! smile

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[1403] - posted: 2014-04-26 20:38:29

Hi Mr Colin,

happy easter smile

the problem here is ziron did not put H_strcpy , the name of my ziron function, in symbol table of obj file. i open the obj file by PE hex editor and PEview.

so when calling H_strcpy from c code and link it with ziron obj file the ld linker did not
recognize H_strcpy name.

i think you have to export the function name in obj file in symbol table.

http://www.freewebs.com/ogremagic/index.htm
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1404] - posted: 2014-04-27 22:01:10
Hi there, seems I broke the linker.dll during the upgrade, please download the following dll plugin and replace the original:

linker.dll [plugin]

then inside your code, add the exports clause to export which functions you want exposed.

e.g.

Code:
program MSCOFF 'test';

#define APPTYPE_LIB;

#include 'win_def.zir';

function  H_strcpy(Dword dst, src) { 
   // your code
}

exports H_strcpy;


Let me know how it works out and i will make sure to include the fixed linker in next release. Thanks for report smile

bare in mind Ziron 2 only supports stdcall for now, i will re-implement cdecl and fastcall very soon, maybe even for next update.

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[1405] - posted: 2014-04-28 20:06:27

Hi ,

your code did not produce coff file

but this code works okay with the new linker.

Code:
program MSCOFF  'test';

#define APPTYPE_CUI;
#include 'win_def.zir';
#Include 'console.zir';

function  H_strcpy(Dword dst, src)
{ 
  uses edx ebx;
  Eax = dst; 
  Edx = src; 
  push Eax;
  BX = word[Edx];
  while ( BX != 0)  
   {
      word[Eax] = BX; 
      Eax++; Edx++; 
      BX =  word[Edx]; 
   }
  word[Eax] = 0;
  pop Eax;
}

exports H_strcpy;


http://www.freewebs.com/ogremagic/index.htm
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1406] - posted: 2014-04-28 21:24:28
OK, glad it is working, just let me know if you have any other problems smile

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1407] - posted: 2014-05-02 11:12:58
btw i see you using low level push, there is a newer feature you may like and might be worth you looking into - emacros.

e.g.

Code:
function H_strcpy(Dword dst, src) { 
  uses edx ebx;
  eax = dst; 
  edx = src; 

  using(eax) {
    bx = [edx];
    while (bx != null) {
      [eax] = bx; 
      eax++;
      edx++; 
      bx = [edx]; 
    }
    char[eax] = null;
  }
}


check out includes/zirutils.zir, they have a lot of potential for useful high level additions smile

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[1408] - posted: 2014-05-23 17:50:33

yes , nice new features Mr. Colin.

My i ask you a question , why Ziron2 progress is very slow?



http://www.freewebs.com/ogremagic/index.htm
Pages: 1 2
create new reply


Quick reply:

Message:



Currently Active Users:
There are currently 8 user(s) online. 0 member(s) and 8 guest(s)
Most users ever online was 1046, January 28, 2022, 2:08 pm.


Statistics:
Threads: 225 | Posts: 1848 | Members: 51 | Active Members: 51
Welcome to our newest member, yecate
const Copyright = '2011-2024 © OverHertz Ltd. All rights reserved.';
Web development by OverHertz Ltd