www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - dmdfe

reply Michael <Michael_member pathlink.com> writes:
Hi

I was trying to turn the dmd front end into a dll with an exported function, so
I made the function dmdfeExport() in mars.c, and added a .def file with the
contents:

EXPORTS
dmdfeExport

and referenced the .def in the makefile. But when linking I get the following
message:

OPTLINK : Error 180: No Match Found for Export/ENTRY -  : dmdfeExport
OPTLINK : Warning 148: USE16/USE32 Mismatch : DGROUP
D:\dm\bin\..\lib\SNN.lib(constart)
Error 83: Illegal frame on start address
OPTLINK : Warning 174: 32-bit Segments Inappropriate for 16-bit Segmented output
OPTLINK : Error 81: Cannot EXPORT : dmdfeExport
dmd\access.obj(access)
Error 35: Cannot Reach TARGET from FRAME at Relative 00014H  from
Segment _TEXT
FRAME  = Frame of Group FLAT 0000
TARGET = External Symbol ?toParent Dsymbol  QAEPAU1 XZ (Dsymbol *syscall
Dsymbol::toParent(void ))
0B079H
FIXUPP Type = 32-bit Conditional JMP

Could someone tell me what I have to do to get it to find the exported function?
Aug 13 2005
parent reply "Walter" <newshound digitalmars.com> writes:
You need to tell the linker it's creating a 32 bit DLL. Add the lines:
    EXETYPE NT
    SUBSYSTEM WINDOWS
to your module definition file.
Aug 13 2005
parent reply Michael <Michael_member pathlink.com> writes:
Thank you very much Walter. 

I renamed the main() func (cos its not an exe anymore).

But now I have this problem where when its linking it cant find any of the win32
apis. Heres a sample:

dmd\root.obj(root)
Error 42: Symbol Undefined _FindClose 4
dmd\root.obj(root)
Error 42: Symbol Undefined _FindFirstFileA 8
dmd\root.obj(root)
Error 42: Symbol Undefined _CompareFileTime 8
dmd\root.obj(root)
Error 42: Symbol Undefined _FindNextFileA 8
dmd\root.obj(root)
Error 42: Symbol Undefined _DeleteFileA 4

Am I missing something?

In article <ddlcs6$bcm$2 digitaldaemon.com>, Walter says...
You need to tell the linker it's creating a 32 bit DLL. Add the lines:
    EXETYPE NT
    SUBSYSTEM WINDOWS
to your module definition file.

Aug 13 2005
next sibling parent M <M_member pathlink.com> writes:
Ar my problem was that I wasnt linking with kernel32.lib :)

But now my problem is that the DLL runtime startup code/DLLMain() isnt being
called when the dll is loaded :( 


In article <ddliii$fj1$1 digitaldaemon.com>, Michael says...
Thank you very much Walter. 

I renamed the main() func (cos its not an exe anymore).

But now I have this problem where when its linking it cant find any of the win32
apis. Heres a sample:

dmd\root.obj(root)
Error 42: Symbol Undefined _FindClose 4
dmd\root.obj(root)
Error 42: Symbol Undefined _FindFirstFileA 8
dmd\root.obj(root)
Error 42: Symbol Undefined _CompareFileTime 8
dmd\root.obj(root)
Error 42: Symbol Undefined _FindNextFileA 8
dmd\root.obj(root)
Error 42: Symbol Undefined _DeleteFileA 4

Am I missing something?

In article <ddlcs6$bcm$2 digitaldaemon.com>, Walter says...
You need to tell the linker it's creating a 32 bit DLL. Add the lines:
    EXETYPE NT
    SUBSYSTEM WINDOWS
to your module definition file.


Aug 13 2005
prev sibling parent Michael <Michael_member pathlink.com> writes:
Ar my problem was that I wasnt linking with kernel32.lib :)

But now my problem is that the DLL runtime startup code/DLLMain() isnt being
called when the dll is loaded :( 


In article <ddliii$fj1$1 digitaldaemon.com>, Michael says...
Thank you very much Walter. 

I renamed the main() func (cos its not an exe anymore).

But now I have this problem where when its linking it cant find any of the win32
apis. Heres a sample:

dmd\root.obj(root)
Error 42: Symbol Undefined _FindClose 4
dmd\root.obj(root)
Error 42: Symbol Undefined _FindFirstFileA 8
dmd\root.obj(root)
Error 42: Symbol Undefined _CompareFileTime 8
dmd\root.obj(root)
Error 42: Symbol Undefined _FindNextFileA 8
dmd\root.obj(root)
Error 42: Symbol Undefined _DeleteFileA 4

Am I missing something?

In article <ddlcs6$bcm$2 digitaldaemon.com>, Walter says...
You need to tell the linker it's creating a 32 bit DLL. Add the lines:
    EXETYPE NT
    SUBSYSTEM WINDOWS
to your module definition file.


Aug 13 2005