You need to understand something about C to approach this problem.

A big issue is that C structs have implementation specific rules about
how they are laid out in memory.

So that means either (a) studying how the C implementation lays out
that struct in memory so you can write to memory directly, (search
for: site:jsoftware.com cd mema), or (b) writing a C function to
allocate and populate the struct (and another to free it, unless you
only need one instance, and so on...) and return its address (void*)
so you can go further.

If you want the language spec to control the memory layout of your
data structure in C, you need to be using arrays, and not structs.

Thanks,

-- 
Raul



On Tue, Aug 14, 2018 at 1:55 PM Rodrigo de Azevedo
<roddeazev...@gmail.com> wrote:
>
> Dear J community,
>
> I am a novice. This is my first time posting here.
>
> I have a C function of the following type
>
> int parser(const char *str, Block *blck);
>
> where Block is a struct that has a nested array of structs. I would like to
> call this parsing function in J via a DLL. I have asked a question on Stack
> Overflow that contains all the details:
>
> https://stackoverflow.com/q/51813984/6338725
>
> I assume that a somewhat similar question has been asked before on this
> forum. I searched the forums and found some related stuff (e.g., [0]),
> though hard to grok for a novice. If you could please provide pointers to
> (commented) J code that does what I have in mind, I would highly appreciate
> it.
>
> Thank you for the attention,
>
> -Rodrigo
>
> [0] http://www.jsoftware.com/pipermail/programming/2007-May/006699.html
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to