Undefined Symbol: ModuleInfo when Linking DLL Test Program
GeorgeToth
GEToth at verizon.net
Tue Nov 23 21:27:55 PST 2010
I am sure this a stupid mistake on my part.... I create a DLL Test0.dll from the following
file (Test0.d):
=========
module Test0;
import std.stdio;
class Test0
{
export
{
int Test0( string ID0 )
{
printf("<Test0: ID={%s}> ",ID0.ptr);
return ID0.length+5;
}
} // export end
}
export Test0 instTest0() { return new Test0(); }
=========
Lib listing shows the following symbols:
Publics by name module
_D5Test05Test05Test0MFAyaZi _D5Test05Test05Test0MFAyaZi
_D5Test09instTest0FZC5Test05Test0 _D5Test09instTest0FZC5Test05Test0
Publics by module
_D5Test05Test05Test0MFAyaZi
_D5Test05Test05Test0MFAyaZi
_D5Test09instTest0FZC5Test05Test0
_D5Test09instTest0FZC5Test05Test0
=======
It seems everything exported properly. I wrote the following Test Harness Test0h.d:
============
module Test0h;
import Test0;
import std.stdio;
int main()
{
Test0 t0 = instTest0();
puts("Starting main()");
auto tret = t0.Test0("Harness Test0h");
printf("T0 Ret=%d\n",tret);
puts("Ending main()");
return 0;
}
=========
with the following Import Definition file:
=========
module Test0;
import std.stdio;
class Test0
{
int Test0(string ID0);
}
Test0 instTest0();
=========
Watching the compile in verbose mode I get the following with the concluding error:
==============
binary I:\Progs\dmd2\windows\bin\dmd.exe
version v2.050
config I:\Progs\dmd2\windows\bin\sc.ini
parse Test0h
importall Test0h
import object (I:\Progs\dmd2\windows\bin\..\..\src\druntime\import\object.di)
import Test0 (Test0.di)
import std.stdio (I:\Progs\dmd2\windows\bin\..\..\src\phobos\std\stdio.d)
import core.stdc.stdio (I:\Progs\dmd2\windows\bin\..\..\src\druntime\import\core
\stdc\stdio.di)
..........
import std.container (I:\Progs\dmd2\windows\bin\..\..\src\phobos\std\container.d)
semantic Test0h
semantic2 Test0h
semantic3 Test0h
code Test0h
function main
I:\Progs\dmd2\windows\bin\link.exe Test0h,,,"Test0.lib"+user32+kernel32/noi;
OPTLINK (R) for Win32 Release 8.00.8
Copyright (C) Digital Mars 1989-2010 All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
Test0h.obj(Test0h)
Error 42: Symbol Undefined _D5Test012__ModuleInfoZ
=========
I can't get the Test0 to be recognized. If I add it to the compile then of course it works,
and runs properly, but that defeats the purpose of the DLL. Can someone point out my error?
More information about the Digitalmars-d-learn
mailing list