This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Cygwin dll from C# Application


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]