Borland doesn't like Nasm .obj files?
Results 1 to 3 of 3

Thread: Borland doesn't like Nasm .obj files?

  1. #1
    Senior Member
    Join Date
    Jun 2003
    Posts
    772

    Borland doesn't like Nasm .obj files?

    I assemble the following:
    Code:
    global _printhello     ;exports
    
    SECTION .text
    
    _printhello:
    mov ah, 09h
    mov edx, string   ;32-bit register usage is necessary for win32 obj file
    int 21h
    int 20h
    
    SECTION .data
    
    string db 'Hello world!$'
    to a win32 obj file:
    C:\>nasmw -f win32 phile.asm

    This produces a .obj file phile.obj
    Because borland c++ 5.5 doesn't want to link this .obj file I use the COFF2OMF import library conversion tool.
    C:\>coff2omf phile.obj crap.obj

    Then I atttempt to use the exported function _printhello in a C program:
    Code:
    #include <stdio.h>
    
    void printhello();
    
    int main() {
    printhello();
    return 0;
    }
    I compile it and link it together with phile.obj .
    Upon execution an invalid page fault exception occurs and it crashes...
    Also, when I try to debug it with ollydbg it gives some warning that it might be a self-modifying file or something.

    Can anybody help me?
    The above sentences are produced by the propaganda and indoctrination of people manipulating my mind since 1987, hence, I cannot be held responsible for this post\'s content - me

    www.elhalf.com

  2. #2
    AO Curmudgeon rcgreen's Avatar
    Join Date
    Nov 2001
    Posts
    2,716
    I don't think you can use an INT 21h call in a win32 program.

    http://www.chataboutprogramming.com/...192-733-a.html
    I came in to the world with nothing. I still have most of it.

  3. #3
    Senior Member
    Join Date
    Jun 2003
    Posts
    772
    Crap, you are right, I assumed it would work under win9x...
    The above sentences are produced by the propaganda and indoctrination of people manipulating my mind since 1987, hence, I cannot be held responsible for this post\'s content - me

    www.elhalf.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •