Is it possible to call a C function from C#.Net

The example will be, for Linux: 1) Create a C file, libtest.c with this content: #include <stdio.h> void print(const char *message) { printf(“%s\\n”, message); } That’s a simple pseudo-wrapper for printf. But represents any C function in the library you want to call. If you have a C++ function don’t forget to put extern C … Read more

Call F# code from C#

Below is a working example of calling F# from C#. As you encountered, I was not able to add a reference by selecting from the “Add Reference … Projects” tab. Instead I did have to do it manually, by browsing to the F# assembly in the “Add Reference … Browse” tab. —— F# MODULE —– … Read more

How to make a Swift String enum available in Objective-C?

One of the solutions is to use the RawRepresentable protocol. It’s not ideal to have to write the init and rawValue methods but that allows you to use this enum as usual in both Swift and Objective-C. @objc public enum LogSeverity: Int, RawRepresentable { case debug case info case warn case error public typealias RawValue … Read more

How do multiple languages interact in one project?

Having multiple languages in one project is actually quite common, however the principles behind are not always simple. In the simple case, different languages are compiled to the same code. For example, C and C++ code typically is compiled into machine assembler or C# and VB.Net is compiled into IL (the language understood by the … Read more

How to deal with files with a name longer than 259 characters?

.NET 4.6.2 Solution Use the \\?\C:\Verrrrrrrrrrrry long path syntax as described here. .NET Core Solution It just works because the framework adds the long path syntax for you. Pre .NET 4.6.2 Solution Also use the long path syntax and the Unicode version of the Win32 API function with P/Invoke. From Naming Files, Paths, and Namespaces: … Read more

How do I read text from the clipboard?

You can use the module called win32clipboard, which is part of pywin32. Here is an example that first sets the clipboard data then gets it: import win32clipboard # set clipboard data win32clipboard.OpenClipboard() win32clipboard.EmptyClipboard() win32clipboard.SetClipboardText(‘testing 123’) win32clipboard.CloseClipboard() # get clipboard data win32clipboard.OpenClipboard() data = win32clipboard.GetClipboardData() win32clipboard.CloseClipboard() print data An important reminder from the documentation: When the … Read more

Git interoperability with a Mercurial Repository

There’s a new git-remote-hg that provides native support: Bridge support in Git for Mercurial and Bazaar Just copy git-remote-hg to your $PATH, make it executable, and that’s it, no dependencies (other than Mercurial): git clone hg::https://www.mercurial-scm.org/repo/hg/ You should be able to push and pull from it as if it was a native Git repository. When … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)