Ruby / DL problem

I’ve got a DLL that I’m working on interfacing to - i’ve got everything
working except for this one function.

int CreateDataFile ( const char* csUserID,
const char* chOptionalTemplateFilePath,
const char* csPrefix,
const char* csSuffix,
char*& newFileID);

the problem is with the newFileID parameter - it’s defined as “points
to the buffer that receives the string of the File ID created. Maximum
length of this buffer is 20 bytes.”

I’ve tried defining the call as both
@createfile = msg[“CreateDataFile”, “ISSSSP”]
and
@createfile = msg[“CreateDataFile”, “ISSSSS”]

and then passing in the values like this
x = “”
ptr = DL.malloc(20)
a = @createfile.call(‘eldon’,x,x,x,ptr)

the function runs successfully but I can’t ever retrieve the value of
the FileID created from ptr and from what I can tell It still looks
empty. So I figure I must either be defining it incorrectly or passing
it in the call wrong. From my memory of C the & is actually a pointer
to a memory location, but there seems something in my memory that it
might mean something different when referenced like this (it’s been
like 10 years since i did anything in C) and I’ve done a ton of google
searches already.

Any guesses as to what i might be doing wrong?

Thanks

Eldon


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around

Hi,

                             const char* chOptionalTemplateFilePath,

and
it in the call wrong. From my memory of C the & is actually a pointer
to a memory location, but there seems something in my memory that it
might mean something different when referenced like this (it’s been
like 10 years since i did anything in C) and I’ve done a ton of google
searches already.

Any guesses as to what i might be doing wrong?

define like this
@createfile = msg[“CreateDataFile”, “ISSSSP”]

and call like this

ptr = “\0” * 20
a = @createfile.call(‘eldon’,x,x,x,[ptr].pack(“P”))
puts ptr

Regards,

Park H.