Re: C flavors: peaceful coexistence???

  • From: Dave <davidct1209@xxxxxxxxx>
  • To: programmingblind@xxxxxxxxxxxxx
  • Date: Thu, 20 May 2010 18:37:06 -0700

Right, so from your comments, the most scalable solution would be to
write a win32 dll compiled possibly within MSYS that acts as a proxy
for your managed code.  The bridging of the dll to managed code as I
mentioned has a few ways you can approach it.

On 5/20/10, qubit <lauraeaves@xxxxxxxxx> wrote:
> The problem I see with that is that VS has different libraries and so it may
> be necessary to rewrite parts of the source code to implement new
> functionalities.
> Since this code is under development (not by me), I want to stay out of it
> as much as possible. If I could compile everything, including the expected
> libraries, in VS, I agree that would be the safest approach -- in
> particular, it would guarantee compatibility between the calling C# program
> and the dll.
> But the interface functions of the dll only invoke translation operations on
> files or data, and so it really isn't necessary for it to be managed, is it?
> I think not.  The implementation of the dll could be a black box with its
> own memory management and algorithms, and could provide just the handful of
> functions needed for translation.
>
> I'm just thinking out loud.  I believe I have seen in the documentation that
> it is possible to call unmanaged code from managed code. I just have to read
> further for the details and pros and cons.
>
> Thanks for the comments.
> --le
>
>
>
> ----- Original Message -----
> From: "Dave" <davidct1209@xxxxxxxxx>
> To: <programmingblind@xxxxxxxxxxxxx>
> Sent: Thursday, May 20, 2010 8:12 PM
> Subject: Re: C flavors: peaceful coexistence???
>
>
> Though I'm not familiar with MSYS, you likely have a few options:
>
> One way .Net applications access native win32 dll's is through
> something called p-invoke.
>
> http://msdn.microsoft.com/en-us/magazine/cc164123.aspx
>
> among other resources describe this technique.
>
> A step up from this would be to use COM and implement a COM server for
> your unmanaged code which can be translated to managed code with some
> included VS tools.
>
> Of course, now that I briefly google MSYS, it looks like it tries to
> achieve a bourne shell with unix like tools, but still has facilities
> to compile dll's.
>
> http://www.mingw.org/wiki/FAQ
>
> If you are serious about writing for Windows, I'd bite the bullet and
> compile everything including unmanaged code within VS.
>
> On 5/20/10, qubit <lauraeaves@xxxxxxxxx> wrote:
>> Before I invest too much time in trial and error, I want to ask those who
>> have experience with .NET programming whether it is possible for a C#
>> program to call functions in a DLL written in C and compiled with MSYS.
>> The
>> answer is probably no, but I have to ask.  If the answer is yes, my job
>> will
>> be easy.  If no, I need to know what, if any, changes need to be done to
>> the
>> source code for the library to make it compatible, and whether I need to
>> compile it using VS (horrors, as VS's C++ compiler is not intended for use
>> on C).
>> Or are there libraries that I can link to the C code in MSYS to make it
>> compatible as a DLL?
>>
>> Given that there are many DLL's that are used by many programs, I am
>> thinking I probably don't have much to worry about.  Am I right? Is
>> Windows
>> actually more user friendly to program than people make it out to be?
>>
>> Thanks much in advance for any comments.
>> --le
>>
>>
>> __________
>> View the list's information and change your settings at
>> //www.freelists.org/list/programmingblind
>>
>>
> __________
> View the list's information and change your settings at
> //www.freelists.org/list/programmingblind
>
> __________
> View the list's information and change your settings at
> //www.freelists.org/list/programmingblind
>
>
__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

Other related posts: