bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/1055] New: problem with generated dll in MS C# environment


From: helmut dot dipper at aed-sicad dot de
Subject: [Bug ld/1055] New: problem with generated dll in MS C# environment
Date: 7 Jul 2005 13:32:00 -0000

My program written in MS C# (for example "nant" from sourceforge) uses a
function written in pure C and compiled and linked to a dll with cygwin-gcc: if
linked with option "-mno-cygwin" function is executed as expected. if linked
without the option "-mno-cygwin" program finishes execution after return from
function without any message. Linking a gcc-created *.o with MSVC-linker to a
dll is not possible, because the MSVC-linker cannot read the used dll's out of
the cygwin-environment.

versions:
cygwin: 1.5.16
gcc: version 3.3.3 (cygwin special)
ld: GNU ld version 2.15.94 20041229

gcc-commands:
gcc -v -g -shared -o test-cygwin.dll fct.c
gcc -v -g -shared -mno-cygwin -o test-mingw.dll fct.c

sources:
fct.c:
#if defined(WIN32) 
#   define DLL_EXPORT __declspec(dllexport)
#else
#   define DLL_EXPORT /**/
#endif

#include <stdio.h>
#include <string.h>

DLL_EXPORT void dll_fct (char *par)
{
   printf("executing dll_fct with parameter:%s\n",par);
}

test.cs:
using System;
using System.Runtime.InteropServices;   
class Class1
    {
         [DllImport("test-mingw.dll",
            EntryPoint="dll_fct",ExactSpelling=true,
            CharSet=CharSet.Ansi,
            CallingConvention=CallingConvention.StdCall
         )]
        private static extern void dll_fct(string par);

        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main(string[] args) {
            Console.WriteLine("before call dll_fct");
            dll_fct("hello");
            Console.WriteLine("after call dll_fct");
        }
    }

-- 
           Summary: problem with generated dll in MS C# environment
           Product: binutils
           Version: 2.15
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
        AssignedTo: unassigned at sources dot redhat dot com
        ReportedBy: helmut dot dipper at aed-sicad dot de
                CC: bug-binutils at gnu dot org
 GCC build triplet: i686-pc-cygwin-gnu
GCC target triplet: i686-pc-cygwin


http://sources.redhat.com/bugzilla/show_bug.cgi?id=1055

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]