My DJGPP has some serious issues

This is a discussion on My DJGPP has some serious issues within the A Brief History of Cprogramming.com forums, part of the Community Boards category; It will not allow any inline assembler. It will give an error like class 'DI REG' not found in reloading ...

  1. #1
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,590

    My DJGPP has some serious issues

    • It will not allow any inline assembler. It will give an error like class 'DI REG' not found in reloading of asm. None of the examples of assembly in DJGPP from the web work.
    • It will not correctly link all source files in a project correctly. This causes undefined reference errors since the linker is so brain dead it cant find the files - even when they are clearly in the project and when the headers have been correctly included in the source that uses the functions from that file.
    • It also will not correctly link with NASM files, nor will it correctly assemble NASM files, nor will it correctly lexically scan NASM files. I could write oooga booga ooooga and it says it compiled into an .asm with no errors. Yeah right. At last check oooga booga oooga was not a valid instruction from the x86 set.



    And I have RHIDE version 1.4.9 which I think is the latest version of RHIDE for Win9x.

    Either RHIDE is screwed up or DJGPP is.

    Someone please help.

  2. #2
    Disagreeably Disagreeable
    Join Date
    Aug 2001
    Posts
    711
    What version, Bubba?

  3. #3
    Blank
    Join Date
    Aug 2001
    Posts
    1,034
    Well I'm sure you can rule out compiling nasm asm files like gcc file.asm gcc's assembly syntax is somewhat different from nasms, masm etc. I only know the basics but you can experiement with gcc -S main.c. Otherwise I think you need to try to run nasm like "nasm -f elf file.c".

  4. #4
    Blank
    Join Date
    Aug 2001
    Posts
    1,034
    You should also try nasm -f coff since djgpp uses the coff object format.

  5. #5
    Disagreeably Disagreeable
    Join Date
    Aug 2001
    Posts
    711
    No, Nick, he means he can't successfully link the object files Nasm produces with the object files DJGPP produces.

  6. #6
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,590
    The docs to RHIDE claim that all files with the extensions asm and nsm will automatically be assembled by NASM, if RHIDE knows where the NASM executable is. The main reason I'm using NASM is because it i supposed to be able to work from within RHIDE and it uses Intel syntax. I don't feel like learning a new syntax just to gain some speed in my functions for DJGPP. And besides by the time I learned the AT&T syntax, I'd have to do something in Intel syntax and be all messed up.
    But I have several asm files that I know work and RHIDE just acts like they could be anything and it would accept them. Plus when I attempt to call one of my NASM functions from DJGPP, I get an undefined reference as if the linker does not see it. Very frustrating for a man who loves to use assembly to gain FPS.
    By the way I have gotten both programs to output compatible object files, it's just that the linker gives me an undefined reference. The project compiles with 0 errors, 0 warnings, but it wont run, make, or build completely.

    As for the inline assembly problem, I've cut and pasted examples from code snippets, downloads, and tutorials off of the internet. They are all in AT&T format and my RHIDE just pukes out errors on all of it - but I know that the code works. And besides all of the inline assembly is in AT&T syntax which, pardon my opinion, sucks.

    As for the project problem I figured one portion of it out. It seems that when you define a template class you MUST put all of the function bodies in the header. This makes me cringe because this is how newbies use headers when they start out and don't really understand how to use them. I always use headers for prototypes, classes, defines, and structs, etc., and then the CPP file for the bodies of the functions. But with templates you cannot do this or you will get an undefined reference when you attempt to call one of your template class functions. Both DJGPP and Borland both exhibited this behavior. It's probably because the data type for the templates is not known at compile time so templates are linked/bound in/with the code in a different order than other classes.

  7. #7
    Blank
    Join Date
    Aug 2001
    Posts
    1,034
    I sort of experiemented with it on dos and got this to work.
    I guess it works with the underscore since it's the coff object format I think.

    For a test using the command line do
    nasm -f coff tmp.asm
    gcc -o prog main.c tmp.o

    Code:
    ; tmp.asm
    
    section .data
    msg:    db "Hello World!", 10, 0
    
    section .text
    
    extern _printf
    
    global _print_hello
    _print_hello:
                push ebp
                mov ebp, esp
                push dword msg
                call _printf
                add esp, 4
                leave
                ret
    Code:
    /* tmp.h */
    #ifndef TMP_H__
    #define TMP_H__
    
    #ifdef __cplusplus
    extern "C" {
    #endif
                     
    void print_hello(void);
    
    #ifdef __cplusplus
    }
    #endif
    Code:
    /* main.c */
    #include "tmp.h"
    
    int main(void)
    {
            print_hello();
            return 0;
    }
    Last edited by Nick; 05-25-2002 at 11:55 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. GNU C++ Compiler Issues!
    By code_writer in forum Tech Board
    Replies: 4
    Last Post: 05-12-2007, 11:03 AM
  2. Wav edit programmation for dos with DJGPP
    By sprudhom in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 07-17-2003, 07:35 AM
  3. DJGPP project problems
    By VirtualAce in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 06-08-2002, 07:16 PM
  4. DJGPP assembly syntax ills...
    By VirtualAce in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 11-11-2001, 01:54 AM
  5. DJGPP help needed
    By dune911 in forum C++ Programming
    Replies: 6
    Last Post: 09-15-2001, 04:56 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21