Dll and array

Just starting out? Need help? Post your questions and find answers here.
spacebuddy
Enthusiast
Enthusiast
Posts: 356
Joined: Thu Jul 02, 2009 5:42 am

Dll and array

Post by spacebuddy »

Hello All,

Is there anyway in Purebasic to pass an array using a Dll?

What I want to do is create the DLL in Purebasic and pass an array of string to another programming language.

Thanks
AndyMK
Enthusiast
Enthusiast
Posts: 582
Joined: Wed Jul 12, 2006 4:38 pm
Location: UK

Re: Dll and array

Post by AndyMK »

Something like this maybe? This code is not checked so might not work.

Code: Select all

ProcedureDLL AttachProcess(Instance)
  
  Global Dim my_string_array.s(10)
  
EndProcedure

ProcedureDLL DetachProcess(Instance)
  
  FreeArray(my_string_array())
  
EndProcedure

ProcedureCDLL array_of_strings()
  
  my_string_array(0) = "hello"
  my_string_array(1) = "world"
  my_string_array(2) = "DLL"
  
  ProcedureReturn my_string_array()
  
EndProcedure
It depends on what your other language is. You could also use structure arrays which is more like C
Post Reply