<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hmmm, I hope you’re not thinking that ei library does not involve “some form of encoding/decoding”, for that would be strange given that the most of function names in ei library contain words such as  “encode” or decode”. Just sayin’.<div class=""><br class=""></div><div class="">V/<br class=""><div class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On 19 Sep 2020, at 21:29, Brett Hemes <<a href="mailto:brhemes@mmm.com" class="">brhemes@mmm.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="WordSection1" style="page: WordSection1; caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">Could you perhaps elaborate on your reply a bit?  The RT development environment (running in kernel mode) offers only a memory mapped interface besides the aforementioned UDP/TCP option for communication between the RT modules and user mode applications.  I believe “exposing the interface” would require me to both make an interface from scratch and then wrap it as a port driver or NIF to get it into the BEAM.  Aside from some arbitrary handshaking interface via registers I could imagine passing strings via fixed length character buffers but I will still need some form of encoding/decoding… which is how I ended up looking at the ei library.<o:p class=""></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><o:p class=""> </o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">Also, most of what I have read regarding Erlang seems to favor ports over drivers and NIFs as they better align with the Erlang philosophy but I am too new to all this to really know when each is preferred.<o:p class=""></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><o:p class=""> </o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">Thanks much,<o:p class=""></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">Brett<o:p class=""></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><o:p class=""> </o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><b class="">From:</b><span class="Apple-converted-space"> </span>Albin Stigö <<a href="mailto:albin.stigo@gmail.com" style="color: blue; text-decoration: underline;" class="">albin.stigo@gmail.com</a>><span class="Apple-converted-space"> </span><br class=""><b class="">Sent:</b><span class="Apple-converted-space"> </span>Thursday, September 17, 2020 9:32 AM<br class=""><b class="">To:</b><span class="Apple-converted-space"> </span>Max Lapshin <<a href="mailto:max.lapshin@gmail.com" style="color: blue; text-decoration: underline;" class="">max.lapshin@gmail.com</a>><br class=""><b class="">Cc:</b><span class="Apple-converted-space"> </span>Brett Hemes <<a href="mailto:brhemes@mmm.com" style="color: blue; text-decoration: underline;" class="">brhemes@mmm.com</a>>; Erlang Questions <<a href="mailto:erlang-questions@erlang.org" style="color: blue; text-decoration: underline;" class="">erlang-questions@erlang.org</a>><br class=""><b class="">Subject:</b><span class="Apple-converted-space"> </span>[EXTERNAL] Re: Using (stripped down ei.h) with generic TCP instead of ports<o:p class=""></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><o:p class=""> </o:p></div><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">I would expose the kernel code through a char or block device driver. There are already many facilities in most kernels for effective communication with userpace. a<o:p class=""></o:p></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">After all, that's the whole point of a kernel...<o:p class=""></o:p></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><o:p class=""> </o:p></div></div><div class=""><p class="MsoNormal" style="margin: 0in 0in 12pt; font-size: 11pt; font-family: Calibri, sans-serif;">--Albin<o:p class=""></o:p></p><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">On Thu, Sep 17, 2020, 16:00 Max Lapshin <<a href="mailto:max.lapshin@gmail.com" target="_blank" style="color: blue; text-decoration: underline;" class="">max.lapshin@gmail.com</a>> wrote:<o:p class=""></o:p></div></div><blockquote style="border-style: none none none solid; border-left-width: 1pt; border-left-color: rgb(204, 204, 204); padding: 0in 0in 0in 6pt; margin-left: 4.8pt; margin-right: 0in;" class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">Your idea is ok.  Just strip everything you don't need from ei and it will work for you.<o:p class=""></o:p></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><o:p class=""> </o:p></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">As for me, I like enif api more, but Sverker has pointed that I'm misuing it inside drivers and it may break once =)</div></div></div></blockquote></div></div></div></div></div></blockquote></div><br class=""></div></div></body></html>