<div dir="ltr"><div>Again Dwg_Data contains substructures, which you replace with null pointers.</div><div>It really is not easy or small task to implement it on Gambas and I'm not even sure it is necessary..?</div><div>Do you have a working sample file for the sample project, so that I could try if some simple tricks would work?<br></div><div><br></div><div>Personally I would perhaps write a wrapper library in C, so that libredwg would be easy to use in Gambas side.</div><div><br></div><div><br></div><div>Jussi<br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Nov 1, 2020 at 8:13 PM Martin <<a href="mailto:mbelmonte@belmotek.net">mbelmonte@belmotek.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  
    
  
  <div>
    <p>Well I made an little sample for research with the library <span lang="en"><span title="">because GauchoCAD is more complex and
          difficult to follow the code.</span></span></p>
    <p>I made an intent of structure translation but I fail again.</p>
    <p>Please check the readme.md file in the project there are some
      info relevant.<br>
    </p>
    <p>Regards.<br>
    </p>
    <div>On 1/11/20 4:19, Jussi Lahtinen wrote:<br>
    </div>
    <blockquote type="cite">
      
      <div dir="ltr">
        <div>Just a quick reply, I'll look it further when I have more
          time.</div>
        <div>It seems you are passing null pointer as an argument.
          Dwg_Data refers to a structure.</div>
        <div> See:</div>
        <div> <a href="https://git.savannah.gnu.org/cgit/libredwg.git/tree/include/dwg.h#n8846" target="_blank">https://git.savannah.gnu.org/cgit/libredwg.git/tree/include/dwg.h#n8846</a></div>
        <div><a href="http://gambaswiki.org/wiki/lang/structdecl" target="_blank">http://gambaswiki.org/wiki/lang/structdecl</a></div>
        <div><br>
        </div>
        <div>Maybe you can just allocate the memory for it, instead of
          implementing it on Gambas.<br>
        </div>
        <div>Also, please always send a project to demonstrate the
          problem, instead of snipped. <br>
        </div>
        <div><br>
        </div>
        <div>Jussi<br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Sun, Nov 1, 2020 at 4:19 AM
          Martin <<a href="mailto:mbelmonte@belmotek.net" target="_blank">mbelmonte@belmotek.net</a>> wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
          <div>
            <div>
              <p>Hi.<br>
              </p>
              First of all excuse 'nil' knowledge of C since I have just
              started trying to use the library with Extern, export or
              whatever is the correct name of the method.</div>
            <div>I made a module to try to do something with the C
              library in Gambas, but as expected it doesn't work :-(</div>
            <div><br>
            </div>
            <div>Note: I am trying to read the number of layers in a dwg
              plane, <span lang="en"><span title="">I go step by step
                  but the goal is to do many more things</span></span></div>
            <div><span lang="en"><span title="">See please <b>dwg.h</b></span></span></div>
            <div><span lang="en"><span title=""><a href="https://git.savannah.gnu.org/cgit/libredwg.git/tree/include/dwg.h" target="_blank">https://git.savannah.gnu.org/cgit/libredwg.git/tree/include/dwg.h</a><br>
                </span></span></div>
            <div><br>
            </div>
            <div>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</div>
            <div>Library "/usr/local/lib/libredwg:0.0.11"<br>
              <br>
              'EXPORT int dwg_read_file (const char *restrict filename,
              Dwg_Data *restrict dwg);<br>
              Private Extern dwg_read_file(filename As String, Dwg_Data
              As Pointer) As Integer<br>
              <br>
              'EXPORT int dxf_read_file (const char *restrict filename,
              Dwg_Data *restrict dwg);<br>
              Private Extern dxf_read_file(filename As String, Dwg_Data
              As Pointer) As Integer<br>
              <br>
              'EXPORT unsigned int dwg_get_layer_count (const Dwg_Data
              *restrict dwg);<br>
              Private Extern dwg_get_layer_count(Dwg_Data As Pointer) As
              Integer<br>
              <br>
              Public Function info(f As String) As Pointer<br>
              <br>
                Dim info As Pointer<br>
                Dim i As Integer<br>
                Dim q As Integer<br>
              <br>
                i = dwg_read_file(f, info)<br>
              <br>
                q = dwg_get_layer_count(info)<br>
              <br>
                Return q<br>
              <br>
              End</div>
            <div>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</div>
            <div><br>
            </div>
            <div><br>
            </div>
            <div>On 21/10/20 4:00, Jussi Lahtinen wrote:<br>
            </div>
            <blockquote type="cite">
              <div dir="ltr">
                <div>What kind of help do you need?</div>
                <div>Let's say example, this line:</div>
                <div> Shell "/usr/local/bin/dwglayers -f '" & sFile
                  & "' 2>&1 " To sOut</div>
                <div><br>
                </div>
                <div>The problem is to find equivalent function call(s)
                  (in C) from the API documentation. I personally don't
                  have the time.</div>
                <div>However, many here (including me) can help to
                  translate the C function calls to Gambas extern
                  function calls, if that is needed.</div>
                <div><br>
                </div>
                <div>Jussi<br>
                </div>
                <br>
              </div>
              On Wed, Oct 21, 2020 at 3:22 AM Martin <<a href="mailto:mbelmonte@belmotek.net" target="_blank">mbelmonte@belmotek.net</a>>
              wrote:<br>
              <div class="gmail_quote">
                <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
                  I am pleased to announce that GauchoCAD[1], which as
                  you know is a CAD <br>
                  made with Gambas, is in good health, at the moment the
                  program is <br>
                  capable of opening autocad DWG plans (thanks to
                  LibreDWG[2]) that close <br>
                  LibreCAD[3].<br>
                  We are using the library with the Shell instruction,
                  which is not the <br>
                  best in terms of performance.<br>
                  We need some help in order to do something with Extern
                  or directly a <br>
                  gb.component that uses this library. Of course, if
                  someone does this it <br>
                  will be useful for many other projects not just
                  GauchoCAD.<br>
                  <br>
                  We need read/write dwg and dxf files more efficiently<br>
                  <br>
                  Here we are an script to install LibreDWG in the
                  system<br>
                  <br>
                       #!/bin/bash<br>
                       git clone git://<a href="http://git.sv.gnu.org/libredwg.git" rel="noreferrer" target="_blank">git.sv.gnu.org/libredwg.git</a><br>
                       cd libredwg<br>
                       sh autogen.sh<br>
                       ./configure --enable-trace<br>
                       make<br>
                       sudo make install<br>
                       make check<br>
                       cd ..<br>
                  <br>
                  [1] <a href="https://github.com/tercoide/GauchoCAD" rel="noreferrer" target="_blank">https://github.com/tercoide/GauchoCAD</a><br>
                  <br>
                  [2] <a href="https://www.gnu.org/software/libredwg/" rel="noreferrer" target="_blank">https://www.gnu.org/software/libredwg/</a><br>
                  <br>
                  [3] <a href="https://librecad.org/" rel="noreferrer" target="_blank">https://librecad.org/</a><br>
                  <br>
                  Thanks.<br>
                  Martin Belmonte<br>
                  <br>
                  <br>
                  ----[ <a href="http://gambaswiki.org/wiki/doc/netiquette" rel="noreferrer" target="_blank">http://gambaswiki.org/wiki/doc/netiquette</a>
                  ]----<br>
                </blockquote>
              </div>
              <br>
              <fieldset></fieldset>
              <pre>----[ <a href="http://gambaswiki.org/wiki/doc/netiquette" target="_blank">http://gambaswiki.org/wiki/doc/netiquette</a> ]----
</pre>
            </blockquote>
          </div>
        </blockquote>
      </div>
    </blockquote>
  </div>

<br>
----[ <a href="http://gambaswiki.org/wiki/doc/netiquette" rel="noreferrer" target="_blank">http://gambaswiki.org/wiki/doc/netiquette</a> ]----<br>
</blockquote></div>