dll from C

J

JC

Hi all,

I've asked similar question before, but I would like to confirm the
following:

From C,
I've this function
void sth_func( void *st, unsigned char bits, short *synth, int bfi );
and in the sample code of C, the func is called by
sth_func(destate, analysis, synth, 0);
where
int* destate;
unsigned char analysis[14];
short synth[160];

And in vb.net, I import this function by
Declare Sub sth_func Lib "amr.dll" ( _
ByVal st As IntPtr, _
ByRef bits As Short, _
ByRef synth As Short, _
ByVal bfi As Integer _
)

Then how should the function call look light in VB?

JC
 
B

Bart Mermuys

Hi,


JC said:
Hi all,

I've asked similar question before, but I would like to confirm the
following:

From C,
I've this function
void sth_func( void *st, unsigned char bits, short *synth, int bfi );
and in the sample code of C, the func is called by
sth_func(destate, analysis, synth, 0);
where
int* destate;
unsigned char analysis[14];
short synth[160];

And in vb.net, I import this function by
Declare Sub sth_func Lib "amr.dll" ( _
ByVal st As IntPtr, _
ByRef bits As Short, _
ByRef synth As Short, _
ByVal bfi As Integer _
)

Then how should the function call look light in VB?

JC

If you are still talking about the amr stuff (previous post) then you could
try something like:

Declare Auto Function Decoder_InterFace_init Lib "amr.dll" () As IntPtr

Declare Auto Sub Decoder_Interface_Decode Lib "amr.dll" ( _
ByVal st As IntPtr, bits As Short(), _
synth As Short(), bfi As Integer )

Dim st As IntPtr
Dim bits(14) As Short
Dim synth(160) As Short
Dim bfi As Integer = ....
....
st = Decoder_InterFace_init()
....
Decoder_Interface_Decode( st, bits, synth, bfi )
.....

Seems that bits can be either Short() or Byte() depending on how the amr dll
was build, you need to check that.

HTH,
Greetings
 
D

Dragon

Hi,
void sth_func( void *st, unsigned char bits, short *synth, int
bfi );
Declare Sub sth_func Lib "amr.dll" ( _
ByVal st As IntPtr, _
ByRef bits As Short, _
ByRef synth As Short, _
ByVal bfi As Integer _
)

OK, I see you mixed the bits param declaration up. In C it's unsigned
Then how should the function call look light in VB?

I can't understand what's your problem. Can't you call it as ~
sth_func(destate, analysis, synth, 0) ~ as it's done in C?

Roman
 
J

JC

Hi,

I failed in running my dll library which compiled from eVC4.0

My target device is 02 Xda2. And in evc, I choose the OS is Pocket PC 2003
and the target is ARMV4 Release.

However, when download to device, it jump out at "DllClass.
Decoder_Interface_init()". The same result when run in emulator.

Any idea?
 
B

Bart Mermuys

Hi,

JC said:
Hi,

I failed in running my dll library which compiled from eVC4.0

My target device is 02 Xda2. And in evc, I choose the OS is Pocket PC 2003
and the target is ARMV4 Release.

However, when download to device, it jump out at "DllClass.
Decoder_Interface_init()". The same result when run in emulator.

Any idea?

Most PInvoke i done was not for the pocket pc, though i've done some.

What do you mean with "jumps out" ? Do you get an exception ? Or what
happens ?

I assume you have a non-NET application (evc) that you used to test if the
dll works ...

HTH,
Greetings
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top