Exported Class Error

rikki cattermole via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jul 14 22:08:32 PDT 2017


On 15/07/2017 5:31 AM, Damien Gibson wrote:
> Hi. I find myself comming back here alot which is a little discouraging.
> 
> This time around, I have a dll im making, right now its 32bit using dmd 
> cause i have been getting better information when compile errors occur.
> 
> if i have a class in it, and i call export on all the functions i want 
> exposed and attempt to use this class in an application that calls 
> either a static or shared lib it fails to compile giving me an error:
> 
>   Error 42: Symbol Undefined _D4asfw7network6server6server7__ClassZ
> obj\Debug\serverApp.obj(serverApp)
>   Error 42: Symbol Undefined 
> _D4asfw7network6server6server6__ctorMFkZC4asfw7network6server6server
> obj\Debug\serverApp.obj(serverApp)
>   Error 42: Symbol Undefined _D4asfw7network6server12__ModuleInfoZ
> Error: linker exited with status 3
> Exit code 3
> 
> I had compiled in LDC2 compiler and this particular error was extended a 
> little more to tell me that all 3 of these errors are caused on the 
> exact same line where i declare a class object i named socket (outside 
> of said function so its global) --
> 
> 'socket = new Server(my param data);'
> 
> My main assumption was much less that the first and third error reports 
> meant anything significant in this case but moreso because it wasnt 
> finding the constructor which seems to me to point at the __ctor one. 
> However when i open the shared library with depends.exe the exact 
> '_D4asfw7network6server6server6__ctorMFkZC4asfw7network6server6server' 
> exists in the dll, just without the _ at the beginning so im thinking 
> maybe something about the .di file is making it think there should be a 
> _ at the beginning and maybe some way i can modify the di will make it 
> stop adding this because that function IS there.
> 
> Also i am not sure if this is a related issue, but i have another dll 
> which the above mentioned problem dll and app cant find some structures 
> i made unless i specificly compile it as a static library and the 
> structure does happen to be used IN the constructor of the server object 
> that keeps failing.
> 
> Any help would be appreciated ive been trying to figure out what the 
> heck to do with this for about 2 days now and not getting an inch further.

TypeInfo doesn't cross the dll boundary atm on Windows.
Known bug.

Which means no classes or exceptions.

https://issues.dlang.org/show_bug.cgi?id=4071


More information about the Digitalmars-d-learn mailing list