Thanks to the help from BrowserUK, I've already figured out that I have to write wrapper functions.
I've tried it the way you did above:
int wrap_RegisterClient2(int cl_id, char* read_ip) {
return RegisterClient2(cl_id, read_ip);
}
but it doesn't work, I get the same error message as in the case without the wrapper.
It works with BrowserUK's method. In fact, I have to go one step further:
int wRegisterClient2( SV *id, SV *IP ) {
int c_id = SvIV( id );
char *c_ip = SvPVX( IP );
int result = RegisterClient2( &c_id, c_ip );
printf("%d", c_id);
sv_setiv(id, (IV) c_id);
return result;
}
Basically, the purpose of this RegisterClient2 function is to establish contact with the instrument that listens on the given IP address, and it gives back a unique numeric id in nClientId that I have to use in further calls. And if I want to access this id from Perl, I have to write back the integer value into the SV that was passed to the wrapper.
So what follows now is me rolling up my sleeves and go elbow-deep into perlguts.
Thanks to the advice anyway.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.