Bonjour,
voilà j'ai un problème de manipulation de pointeurs...
Voici la déclaration des fonctions d'une classe C++:
Et ce code fonctionne sans problème ://Obtains the virtual address of one of the driver managed system buffers.
Berr system_buffer_map(void** ppAddress, int BufferId);
//Assign an arbitrary usermode buffer to a particular DMA function.
BErr system_buffer_assign(void* pAddress, unsigned long Id, unsigned long Length, unsigned long Target);
Maintenant je veux utiliser l'objet COM. L'interface est la même que la classe C++ à quelques exceptions près :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5 void * m_Buffers[2]; mpSDK->system_buffer_map(&m_Buffers[0], BUFFER_ID_VIDEO0); mpSDK->system_buffer_map(&m_Buffers[1], BUFFER_ID_VIDEO1); mpSDK->system_buffer_assign(m_Buffers[0], BUFFER_ID_VIDEO0, mGolden, BUFFER_TYPE_VIDEO); mpSDK->system_buffer_assign(m_Buffers[1], BUFFER_ID_VIDEO1, mGolden, BUFFER_TYPE_VIDEO);
Donc voici la déclaration des fonctions dans l'interface COMThe COM object is a simple wrapper of the original C++ implementation
The only difference between the class and interface is in the way the parameters are passed in COM. The differences are as given below.
- All unsigned long parameters in C++ have been changed to long in COM Object.
- Reference parameters in the C++ Class has been changed to OUT Parameters in the COM Interface.
- The Pointer to Pointer parameters in the C++ Class has been implemented in a different way in the COM Interface. The address of the requested memory location is passed back to the caller as a long value.
Comment convertir le code ?Berr system_buffer_map(long* ppAddress, int nBufferId);
BErr system_buffer_assign(long* pAddress, long Id, long Length, long Target);
Merci pour vos réponses car je suis un peu perdu. En général, quoique je fasse, mon programme explose.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5 void * m_Buffers[2]; mpCOM->system_buffer_map(???, BUFFER_ID_VIDEO0); mpCOM->system_buffer_map(???, BUFFER_ID_VIDEO1); mpCOM->system_buffer_assign(???, BUFFER_ID_VIDEO0, m_Golden, BUFFER_TYPE_VIDEO); mpCOM->system_buffer_assign(???, BUFFER_ID_VIDEO1, m_Golden, BUFFER_TYPE_VIDEO);![]()
Partager