Discussion:
Issue with WIKI example Win32_DLLs_in_D
Andre via Digitalmars-d-learn
2014-10-21 19:59:50 UTC
Permalink
Hi,

by copy and paste the example from
http://wiki.dlang.org/Win32_DLLs_in_D
exactly as described, the following errors is thrown:

J:\Projects\Tests\Example>dmd test mydll.lib -g
OPTLINK (R) for Win32 Release 8.00.15
test.obj(test)
Error 42: Symbol Undefined _D5mydll12__ModuleInfoZ

I created a batch program which executes the commands
as described on the wiki page:

dmd -c mydll -g
dmd mydll.obj mydll.def -g -L/map
C:\D\dmd2\windows\bin\implib /noi /system mydll.lib mydll.dll
dmd test mydll.lib -g

Could you check whats wrong with the example and maybe update the
WIKI page?
Thanks.

Kind regards
André
Laeeth Isharc via Digitalmars-d-learn
2014-10-21 21:57:04 UTC
Permalink
Funnily enough I was just playing with this last night trying to
get Excel to talk to dlang DLL. I borrowed a C example elsewhere
on web and used a different .def file. Something like this:

LIBRARY dprop
DESCRIPTION 'My DLL written in D'

EXETYPE NT
CODE PRELOAD DISCARDABLE
DATA WRITE

EXPORTS
useArray = useArray
usemyTest = usemyTest

Where the two functions exported from D to excel were as above.
Try that and let me know. If that doesn't work I will send you a
link to from repository.
Post by Andre via Digitalmars-d-learn
Hi,
by copy and paste the example from
http://wiki.dlang.org/Win32_DLLs_in_D
J:\Projects\Tests\Example>dmd test mydll.lib -g
OPTLINK (R) for Win32 Release 8.00.15
test.obj(test)
Error 42: Symbol Undefined _D5mydll12__ModuleInfoZ
I created a batch program which executes the commands
dmd -c mydll -g
dmd mydll.obj mydll.def -g -L/map
C:\D\dmd2\windows\bin\implib /noi /system mydll.lib mydll.dll
dmd test mydll.lib -g
Could you check whats wrong with the example and maybe update
the WIKI page?
Thanks.
Kind regards
André
andre via Digitalmars-d-learn
2014-10-22 15:16:08 UTC
Permalink
I think there is a bigger issue with the mentioned example.
The command cannot work:
dmd test mydll.lib -g

test.d has an import statement to mydll. mydll has to be included
in the command. But as mydll not only contains the exported dll
functions but also DllMain, it cannot be compiled together with
test which contains the main entry point.

Maybe the example can be corrected.

Kind regards
André
Post by Laeeth Isharc via Digitalmars-d-learn
Funnily enough I was just playing with this last night trying
to get Excel to talk to dlang DLL. I borrowed a C example
elsewhere on web and used a different .def file. Something
LIBRARY dprop
DESCRIPTION 'My DLL written in D'
EXETYPE NT
CODE PRELOAD DISCARDABLE
DATA WRITE
EXPORTS
useArray = useArray
usemyTest = usemyTest
Where the two functions exported from D to excel were as above.
Try that and let me know. If that doesn't work I will send
you a link to from repository.
Loading...