CF 2.0 and static extern DLL Imports

L

Lonifasiko

Related to my MP3 playing previous post
http://groups.google.es/group/micro...8b88207b296/8797f97d826b33a5#8797f97d826b33a5

To play MP3 files in CF 1.0 I'm using FMODCE.DLL and my code does many
imports of static extern DLL. This is an example:

[DllImport("fmodce", EntryPoint = "FSOUND_Init", SetLastError = true)]
public static extern sbyte FSOUND_Init(int mixrate, int
maxsoftwarechannels, uint flags);

These kind of imports were working for CF 1.0, but they now don't work
in a project built with CF 2.0. Does CF 2.0 not admit this kind of
imports? Is there another way of invoking functions inside an unmanaged
DLL like FMODCE?

It's a remote idea, but could be possible although my project is mainly
developed using CF 2.0, to use somehow CF 1.0 just to make this imports
and play MP3 successfully?

Thanks in advance.
 
P

Peter Foot [MVP]

There should be no reason why the same P/Invokes don't work. What exception
do you get? is the fmodce.dll file present in the application folder or the
\windows\ folder?

Peter
 
G

Guest

Did you build the FMOD DLL yourself against CF 2.0 or are you using an
already compiled version?

-Chris
 
L

Lonifasiko

Thanks guys,

Peter: The strangest thing is that no exception is thrown. Music is
simply not played -:(, but any error appears on my form. I've already
tried this three options:
- with fmodce.dll only
located in the application's output directory
- fmodce.dll only
located under \Windows folder
- The DLL in both
places

This way doesn't work.

Chris: I'm already using the fmodce.dll you can download from their
site. It is an already compiled DLL, and I guess it is written is C/C++
(so cannot have been compiled only for CF 1.0). Anyway, I suppose it
can only target CF 1.0. What a pity! But it's odd since the very basic
P/Invokes I'm using I think should work, as Peter have said.

With this kind of migration problems, I'm thinking of continuing
working with VS.NET 2005, targeting PPC2003 but using CF 1.0 rather
than CF 2.0. This way I'm sure I can play MP3 files wihout problems.
What do you think about this crazy idea? Would I be loosing much
functionality, reliability and performance that CF 2.0 brings? What
about combining them? Would be possible?

Returning to the beginning of my post.........Let me know if you find
another way of playing MP3 files in a PDA. I think this could be
someway easily done for CF 2.0.

Thanks very much in advance.
 
P

Peter Foot [MVP]

Just a thought, are you sure the sbyte return type is correct? most methods
return a 4byte value e.g. int (long in c++), BOOL etc Because .NETCF v1.0
didn't support as many types with P/Invoking it did a few things
automatically to convert values, therefore it's possible you need to check
your types used, or use MarshalAs attributes...

Peter
 
L

Lonifasiko

Thanks Peter, but I'm almost sure the return type is sbyte. Most
methods of fmodce.dll have this type of return, but I'll check it out
on wednesday. Today and tomorrow is holiday in Spain. ;-)

You mean CF 1.0 did some automatic conversions that CF 2.0 does not?

I still think there must be a very simple way to play MP3 files on a
PPC in a CF 2.0 application. What about my other questions? Only using
CF 1.0 (I know MP3 files can be played with fmodce.dll) or combining
thw two frameworks?

Regards.
 

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

Top