This is a page gathering how-tos and links to relevant information to get some things running.

Debugging with Monodevelop

At some point in the past, I did manage to have the rClr native code debugged from Monodevelop. I think, anyway. Seems I cannot anymore.

Now regarding how to figure how the following issue, which ends up with the R console spitting the dummy. How to set up the mono soft debugger to attach to the R process.
Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object
  at RDotNet.Devices.CharacterDeviceAdapter.ResetConsole () [0x00000] in <filename unknown>:0 


http://lists.ximian.com/pipermail/mono-devel-list/2012-November/039817.html
http://www.jeffongames.com/2012/03/debugging-embedded-mono/
http://stackoverflow.com/questions/9582365/debugging-w-embedded-mono-how-to-set-breakpoints-in-c-sharp-code

export MONODEVELOP_SDB_TEST=1


Seems that following the instructions work. Can hook up breakpoints. However when trying to debug the R.NET related issue, catching the exception fails. The mono runtime spits the dummy with a SIGSEV.

Debugging tools

Aside from valgrind, sayw the mention on the R-devel mailing list of the AddressSanitizer. Seems to be soon included in LLVM clang and gcc.

Data marshalling

The following links stem from looking how to invoke from rClr.dll a managed method such as "public object CreateSomeRdotNetStructure(IntPtr ptr, int sexptype)". It looks like the corresponding type to IntPtr is (void *), but while P/Invoke from C# works, rdotnet as a proof, I could not find the other way around to obtain an IntPtr. I think I could create the IntPtr in C# from end int or long, but this is where the rub is: a platform-dependent code...

Platform Invoke Data Types
http://msdn.microsoft.com/en-us/library/ac7ay120(v=vs.110).aspx

VARIANT Type Constants
http://msdn.microsoft.com/en-us/library/cc237865.aspx

May be of interest:
http://msdn.microsoft.com/en-us/library/bb162198(v=vs.110).aspx

http://stackoverflow.com/questions/9591579/clr-hosting-call-a-function-with-an-arbitrary-method-signature

http://www.codeproject.com/Articles/12662/Unmanaged-to-Managed-calls-C-to-C-without-Regasm

http://social.msdn.microsoft.com/Forums/en/clr/thread/3591cce9-e0f1-4c4e-8ad3-5952e9114ede

VARIANT structure
http://msdn.microsoft.com/en-us/library/ms221627(v=VS.85).aspx

http://atom0s.wordpress.com/2012/11/30/native-clr-hosting-with-separate-appdomains-per-module

An interested pointer, albeit not actively maintained:
http://clrinterop.codeplex.com/

Other links of interest

Read http://www.codeproject.com/Articles/416471/CLR-Hosting-Customizing-the-CLR and the follow up article.

Last edited Jun 29, 2013 at 9:01 AM by jperraud, version 5

Comments

No comments yet.