delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/09/02/22:32:46

From: chrhenz AT aol DOT com (ChrHenz)
Newsgroups: comp.os.msdos.djgpp
Subject: Linking problem (?)
Date: 3 Sep 1997 01:37:22 GMT
Lines: 50
Message-ID: <19970903013701.VAA06536@ladder01.news.aol.com>
NNTP-Posting-Host: ladder01.news.aol.com
Organization: AOL Bertelsmann Online GmbH & Co. KG http://www.germany.aol.com
SnewsLanguage: German
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I seem to have a little problem with linking... or with my programming
abilities ! Find out by looking at the following :
My NASM assembly-source looks something like this:

BITS 32
EXTERN ___dpmi_segment_to_selector
GLOBAL _GetSelector
SECTION .data
_Selector dw 0
SECTION .text
_GetSelector:
	push dword 0a000h
	call ___dpmi_segment_to_selector
	; (...)
	mov [_Selector],ax
	ret

My C-source looks something like this:

#include <stdio.h>
#include <dpmi.h>
extern void GetSelector(void);
main()
{
GetSelector();
}

Now I do the following:
nasm -f coff asmfile.asm (everything seems o.k. util here...)
gcc cfile.c -o cfile.exe asmfile.o (here I get the error message "...
asmfile.asm: undefined reference to '__dpmi_segment_to_selector'")

To find out whether my asmfile.o was the fault, I tried this...

#include <stdio.h>
#include <dpmi.h>
main()
{
int i;
i=__dpmi_segment_to_selector(0xa000);
}

...tried to compile it...
gcc cfile.c -o cfile.exe
...and got the error-message "...cfile.c: undefined reference to
'__dpmi_segment_to_selector'"
Is there someone out there who could tell me what's going on here ?
(Perhaps I should add that I didn't get any other error-messages.)

Thanks in advance... Christian (ChrHenz AT aol DOT com)

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019