Is it possible to modify a method body at runtime using mono embed API. Is there is a way to access method's body and signature. I know it's a little bit complicated but I really need it for a school project.
I was able to do this with the .Net framework. I found out that the .Net framework resolves all the methods at the managed code and there is an external method called SetmethodIL which I had to call using refelection and It worked but mono takes a different route. Mono takes the unmanaged code choice which calls an external method called create_runtime_class that gets the job done.
Thank you for your support.
I found out by examining the reflection_methodbuilder_to_mono_method method that a MonoMethod must have a MonoMethodHeader which contains information about the method.
At the line 3014 you will see how they were able to set the code of the method by passing the array address as a guint8.
As far as I know the code contains the CIL Instructions which is an array of bytes.
By using the method called mono_method_get_header you will be able to get the header of any method and by using technique above you will be able to modify the code. But I'm not sure if this gonna work or not It may only works with dynamically generated methods.
If you call an internal call with a byte array parameter to c Maybe we could get it right.
Related
I created a function module and gateway service that reads data from SNAP_BEG table which is stores DUMP issues. There is no any error except that.
When I try to use link as /DumpsetSet I get
"Method 'DUMPSETSET_GET_ENTITYSET' not implemented in data provider class"
I found that how to redefine implementation but what code should I write in it? I cant find an example for this. Function module code is.
SELECT * FROM SNAP_BEG INTO TABLE ET_SNAP_BEG.
Or I just need to use something else?
What type of link should I use. I got one more project someoneelse done and I cant see difference in implementation from mine.
Edit: I can get firs record that program find by /DumpsetSet('username'). But it is not giving me all datas anyway.
Did you map the GetEntitySet to a data source from SEGW - SAP Gateway Service Builder, under the Service Implementation part. After this operation you should generate runtime objects.
There is a good blog for this, here.
In the tutorial for erl_driver there seems to be no indication to where does the first ErlDrvPort object comes from. Say I want to wrap libusb-1.0 to use it from erlang. There is no place in the API described by ErlDrvEntry for any index methods. How does one find a port to open?
Normally you obtain the first port using the erlang:open_port/2 function, usage of which is shown in the code example in section 6.2 of the tutorial you linked to in your question.
Instead of using Ports to wrap a C library, you can also use NIFs. With Nifty there exists even a wrapper generator that does most of the work for you.
I am trying to create an extension to wrap an existing DLL without extensive knowledge of C/++. I have used the sample extension as a base and everything seems to work fine, what I would like to do is have some error handling inside my dll.
Is there a way of sending custom errors back to dart if something inside the dll fails? Would it just be a case of sending lets say an array with the first parameter being a bool as to whether it failed or not and the second parameter being a string for the error if there is one. Or is there an actual way to throw errors from the dll itself?
Hope this made sense,
Thanks,
You should take a look inside dart_api.h file, it contains a lot of comments about Dart native stuff.
I have found Dart_ThrowException function there, but also a comment saying that Dart_NewUnhandledExceptionError should be used instead.
Both functions need a Dart exception object handle. It seems that Dart team uses their own Dart Util library to create them:
Dart_ThrowException(DartUtils::NewDartArgumentError("error message"))
I want to play a media file from a memory stream using LibVLC like so:
//Ideally it would go like this:
LibVLC.MediaFromStream = new MemoryStream(File.ReadAllBytes(File_Path));
Of course this is a very oversimplified version of what I want but hopefully it conveys what I am looking for.
The reason being that I want there to be a good amount of portability for what I'm doing without having to track file locations and such. I'd rather have a massive clump of data in a single file that can be read from than have to track the locations of one or many more files.
I know this has something to do with the LibVLC IMEM Access module. However, looking at what information I've been able to find on that, I feel like I've been tossed from a plane and have just a few minutes to learn how to fly before I hit the ground.
See my answer to a similar question here:
https://stackoverflow.com/a/31316867/2202445
In summary, the API:
libvlc_media_t* libvlc_media_new_callbacks (libvlc_instance_t * instance,
libvlc_media_open_cb open_cb,
libvlc_media_read_cb read_cb,
libvlc_media_seek_cb seek_cb,
libvlc_media_close_cb close_cb,
void * opaque)
allows just this. The four callbacks must be implemented, although the documentation states the seek callback is not always necessary, see the libVlc documentation. I give an example of a partial implementation in the above answer.
There is no LibVLC API for imem, at least not presently.
You can however still use imem in your LibVLC application, but it's not straightforward...
If you do vlc -H | grep imem you will see something like this (this is just some of the options, there are others too):
--imem-get <string> Get function
--imem-release <string> Release function
--imem-cookie <string> Callback cookie string
--imem-data <string> Callback data
You can pass values for these switches either when you create your libvlc instance via libvlc_new(), or when you prepare media via libvlc_media_add_option().
Getting the needed values for these switches is a bit trickier, since you need to pass the actual in-memory address (pointer) to the callback functions you declare in your own application. You end up passing something like "--imem-get 812911313", for example.
There are downsides to doing it this way, e.g. you may not be able to seek backwards/forwards in the stream.
I've done this successfully in Java, but not C# (never tried).
An alternative to consider if you want to play the media data stored in a file, is to store your media in a zip or rar since vlc has plugins to play media from directly inside such archives.
Is this:
Web web = context.Web;
context.Load(web, w => w.Language);
context.ExecuteQuery();
or something similar in order to load web.Language with context.ExecuteQuery() possible in a silverlight client? The above code was taken from
http://www.dev4side.com/community/blog/2011/1/5/incorrect-dates-taken-from-sharepoint-2010-client-object-model.aspx
When I do so, instantiating the web's Language property always yields
Microsoft.SharePoint.Client.PropertyOrFieldNotInitializedException
Btw, this code is in an extra thread (not the UI thread). I know that there is context.loadQueryAsync() but I already have an extra thread and would like to keep things together.
As far as I've tried this code works ok. Do you maybe access some other properties of the Web object that are not loaded? You'd have to include them also in your load method.