Thread overview
[Issue 985] New: dll-imported functions return values broken
Feb 19, 2007
d-bugmail
Feb 19, 2007
d-bugmail
Feb 23, 2007
d-bugmail
February 19, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=985

           Summary: dll-imported functions return values broken
           Product: D
           Version: 1.006
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: critical
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: dbugz@mailinator.com


Values retrieved from dll function calls by return, seems to be random garbage.

I have set up extremely simple test case reproducing misbehavior:

0. Extract attached archive to project directory.
1. Compile visualstudio project.
2. Copy dll and lib to projects folder.
3. Run `coffimplib.exe -f dlltest.lib`.
4. Run `make_d.cmd` to compile D test program.

Run test.exe to see if output is, or is not expected:
"dlltest.get_test():123"


-- 

February 19, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=985





------- Comment #1 from dbugz@mailinator.com  2007-02-19 09:29 -------
Created an attachment (id=105)
 --> (http://d.puremagic.com/issues/attachment.cgi?id=105&action=view)
test case

Attached test suite reproducing error.


-- 

February 23, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=985


thomas-dloop@kuehne.cn changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID




------- Comment #2 from thomas-dloop@kuehne.cn  2007-02-23 16:36 -------
dlltest.h:
# extern "C"{
# extern unsigned long __cdecl get_test();
# }

dlltest.d:
#
# extern(C) ulong get_test();
#

On 32bit systems dlltest.d should be:
#
# extern(C) uint get_test();
#


--