delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/07/23/13:21:15

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Message-ID: <18616035.post@talk.nabble.com>
Date: Wed, 23 Jul 2008 10:20:42 -0700 (PDT)
From: Stefano Facchetti <s DOT facchetti AT kline DOT it>
To: cygwin AT cygwin DOT com
Subject: Cygwin dll from C# Application
MIME-Version: 1.0
X-Nabble-From: s DOT facchetti AT kline DOT it
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

I build my custom dll using g++ and Cygwin environment.
Whe I try to call it, from C# application, it immediatly freeze.

How can I do..?
Fad.

C# code:
[DllImport("faddll.dll", CharSet = CharSet.Auto, EntryPoint = "Somma")]
public static extern int MySum(int a, int b);
int x = MySum(1,2);

C++ code:
#include <stdio.h>
#include <windows.h>

#define DllExport extern "C" __declspec(dllexport)

DllExport int MySum(int a,int b);

int MySum(int a, int b)
{
   HMODULE h = LoadLibrary("cygwin1.dll");
   void (*init)() = (void(*)()) GetProcAddress(h,"cygwin_dll_init");
   init();

   return a+b;
}

-- 
View this message in context: http://www.nabble.com/Cygwin-dll-from-C--Application-tp18616035p18616035.html
Sent from the Cygwin list mailing list archive at Nabble.com.


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019