I can't see anything obviously wrong from what you've posted. I've had a quick look online at the C definition for the function and I would declare it like:
[DllImport("Lame_enc.dll")]
public static extern int beInitStream(ref BE_CONFIG config, out int samples, out int bufferSize, out IntPtr streamHandle);
I've used out rather than ref for the last 3 parameters as this[^] suggests that these values are returned by the function so no need to pass a reference in. Edit: Be sure to check the return value from the function. It will be one of these constants:
public const int BE_ERR_SUCCESSFUL = 0x00000000;
public const int BE_ERR_INVALID_FORMAT = 0x00000001;
public const int BE_ERR_INVALID_FORMAT_PARAMETERS = 0x00000002;
public const int BE_ERR_NO_MORE_HANDLES = 0x00000003;
public const int BE_ERR_INVALID_HANDLE = 0x00000004;
public const int BE_ERR_BUFFER_TOO_SMALL = 0x00000005;
Dave
Binging is like googling, it just feels dirtier. Please take your VB.NET out of our nice case sensitive forum. Astonish us. Be exceptional. (Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)