Reading Dicom files in Dlang

rnd r_narang at yahoo.com
Fri May 31 11:26:40 UTC 2019


On Friday, 31 May 2019 at 11:20:15 UTC, KnightMare wrote:
> whats wrong with answer at SO?
> https://stackoverflow.com/questions/56278268/reading-dicom-files-in-dlang

dlang_wrapper.so file is created.

I try to access it with following file:

import imebra;
import imebra_im;

import core.stdc.stdio;
import core.stdc.stdlib;
import core.sys.posix.dlfcn;

extern (C) int ldl();

void main(){
	//auto loadedDataSet = CodecFactory.load("33141578.dcm") ;
	printf("+main()\n");

     void* lh = dlopen("libdlang_wrapper.so", RTLD_LAZY);
     if (!lh)   {
         fprintf(stderr, "dlopen error: %s\n", dlerror());
         exit(1);
     }
     printf("libdlang_wrapper.so is loaded\n");
}


But it gives following error:

$ rdmd rntestImebra.d
imebra.d(457): Error: function declaration without return type. 
(Note that constructors are always named this)
imebra.d(457): Error: found data when expecting )
imebra.d(457): Error: semicolon expected following function 
declaration
imebra.d(457): Error: declaration expected, not ,
imebra.d(459): Error: no identifier for declarator _a
imebra.d(459): Error: declaration expected, not =
imebra.d(460): Error: no identifier for declarator _b
imebra.d(460): Error: declaration expected, not =
imebra.d(464): Error: function declaration without return type. 
(Note that constructors are always named this)
imebra.d(731): Error: function declaration without return type. 
(Note that constructors are always named this)
imebra.d(731): Error: found other when expecting )
imebra.d(731): Error: semicolon expected following function 
declaration
imebra.d(731): Error: declaration expected, not )
imebra.d(733): Error: declaration expected, not if
imebra.d(734): Error: unrecognized declaration
imebra_im.d(51): Error: module `string` is in file 
'std/c/string.d' which cannot be read
import path[0] = .
import path[1] = /usr/include/dmd/phobos
import path[2] = /usr/include/dmd/druntime/import
Failed: ["/usr/bin/dmd", "-v", "-o-", "rntestImebra.d", "-I."]

Line 457 of part of this code:

   struct Range {
     private __vector(ushort) _outer;
     private size_t _a, _b;

     this(vector(ushort) data, size_t a, size_t b) {   // <<<<<<<< 
line 457
       _outer = data;
       _a = a;
       _b = b;
     }



More information about the Digitalmars-d-learn mailing list