Skip to content

Commit

Permalink
Fixes a segmentation fault, example script now uses the right dll dep…
Browse files Browse the repository at this point in the history
…ending on os
  • Loading branch information
zasulon committed Apr 8, 2022
1 parent 3da1c1d commit a45564b
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions testPy/ImarisWriterCtypesTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
Python Version of bpImarisWriter96TestProgram.c that uses ImarisWriterCtypes
"""

import platform
import sys

from PyImarisWriter import ImarisWriterCtypes as IW
Expand Down Expand Up @@ -136,7 +137,7 @@ def get_parameters(num_channels):
channel_parameter_section.mValuesCount = num_parameters_per_channel
parameter_section_data[section_index] = channel_parameter_section

parameters = IW.bpConverterTypesC_Parameters(parameter_section_data, number_of_sections)
parameters = IW.bpConverterTypesC_ParametersPtr(IW.bpConverterTypesC_Parameters(parameter_section_data, number_of_sections))
return parameters

def get_time_infos(num_time_infos):
Expand Down Expand Up @@ -199,9 +200,20 @@ def print_user_data(title, user_data):
title,
user_data.mProgress,
user_data.mImageIndex))

def get_dll_filename():
if platform.system() == 'Windows':
return 'bpImarisWriter96.dll'
elif platform.system() == 'Darwin':
return 'libbpImarisWriter96.dylib'
elif platform.system() == 'Linux':
return 'libbpImarisWriter96.so'
else:
print('Platform not supported: "{}"'.format(platform.system()))
return None

def test_convert(test_index):
dll_filename = 'bpImarisWriter96.dll'
dll_filename = get_dll_filename()
print('Loading dll: {}'.format(dll_filename))
cdll = IW.CDLL(dll_filename)

Expand Down

0 comments on commit a45564b

Please sign in to comment.