Thread overview | ||||||
---|---|---|---|---|---|---|
|
March 16, 2005 Using NASM and DMD with OptLink | ||||
---|---|---|---|---|
| ||||
Im writing a d version of a basic c kernel I found a tutorial on. I am having trouble getting the assmebly code to link to the D code using OptLink. Is there a good way to do this that i don't know of? MASM diddn't seem to work like I hoped. I am trying to use NASMW and i am telling it to output to obj format. All other formats are "Unrecognized" by OptLink. I get this error when linking my D code with my ASM code. link /TINY Objects\Startup.o Objects\Core.obj, Core.bin OPTLINK (R) for Win32 Release 7.50B1 Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved Objects\Startup.o(Startup) Error 42: Symbol Undefined _core_main OPTLINK : Warning 134: No Start Address Objects\Startup.o(Startup) Warning 47: Below 100H Cannot Be Initialized OPTLINK : Error 46: Start Address Must Be 100H My d code Does indeed have the core_main function defined. Thanks in advance - Trevor |
March 16, 2005 Re: Using NASM and DMD with OptLink | ||||
---|---|---|---|---|
| ||||
Posted in reply to Trevor | In article <d19979$11a2$1@digitaldaemon.com>, Trevor says... > >Im writing a d version of a basic c kernel I found a tutorial on. I am having trouble getting the assmebly code to link to the D code using OptLink. > >Is there a good way to do this that i don't know of? MASM diddn't seem to work like I hoped. > >I am trying to use NASMW and i am telling it to output to obj format. All other formats are "Unrecognized" by OptLink. I get this error when linking my D code with my ASM code. > >link /TINY Objects\Startup.o Objects\Core.obj, Core.bin >OPTLINK (R) for Win32 Release 7.50B1 >Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved > >Objects\Startup.o(Startup) >Error 42: Symbol Undefined _core_main >OPTLINK : Warning 134: No Start Address >Objects\Startup.o(Startup) >Warning 47: Below 100H Cannot Be Initialized >OPTLINK : Error 46: Start Address Must Be 100H > > >My d code Does indeed have the core_main function defined. > >Thanks in advance >- Trevor Most likely you need to declare it as extern(C). _______________________ Carlos Santander Bernal |
March 16, 2005 Re: Using NASM and DMD with OptLink | ||||
---|---|---|---|---|
| ||||
Posted in reply to Carlos Santander B. | Lets say I am stupid. Where do i put the extern (c) code.. Cause I tried it before the core_main function and it gave me errors. my code: extern(c) int core_main() { ClearScreen(); Write("Welcome to my Kernel"); return(0); } my errors: Source\Core.d(48): valid linkage identifiers are D, C, C++, Pascal, Windows Source\Core.d(48): Declaration expected, not ')' Source\Core.d(51): found 'Welcome to My Kernel ' when expecting ')' Source\Core.d(51): no identifier for declarator Source\Core.d(51): no identifier for declarator Source\Core.d(51): semicolon expected, not '0' Source\Core.d(51): Declaration expected, not '0' Source\Core.d(52): Declaration expected, not 'return' Source\Core.d(53): unrecognized declaration Anyhoo... I hope this can be fixed easily. Thanks in advance, Trevor |
March 16, 2005 Re: Using NASM and DMD with OptLink | ||||
---|---|---|---|---|
| ||||
Posted in reply to Trevor | Trevor wrote:
> Lets say I am stupid. Where do i put the extern (c) code.. Cause I tried it
> before the core_main function and it gave me errors.
>
> my code:
>
> extern(c) int core_main()
> {
> ClearScreen();
> Write("Welcome to my Kernel");
> return(0);
> }
>
> my errors:
>
> Source\Core.d(48): valid linkage identifiers are D, C, C++, Pascal, Windows
> Source\Core.d(48): Declaration expected, not ')'
>
> Source\Core.d(51): found 'Welcome to My Kernel
> ' when expecting ')'
> Source\Core.d(51): no identifier for declarator
> Source\Core.d(51): no identifier for declarator
> Source\Core.d(51): semicolon expected, not '0'
> Source\Core.d(51): Declaration expected, not '0'
>
> Source\Core.d(52): Declaration expected, not 'return'
>
> Source\Core.d(53): unrecognized declaration
>
> Anyhoo... I hope this can be fixed easily.
>
> Thanks in advance,
> Trevor
Use a big 'C' in extern(C). You used a little 'c'.
|
Copyright © 1999-2021 by the D Language Foundation