use C header file in a VB project
-
Hi all, I'm developing an application in VB2005.Net 2.0 and I would like to use a C header file that contains many structs that I need in the project. This structs are going to change quite often so I wouldn't like to migrate the structs from the C file to VB code each time that the header file changes. The best thing for me would be to include the '.h' file directly into my project so I could access it directly. Is it possible to do it in any way? Could it be possible to do it encapsulating the '.h' file into a library and then reference it from the VB project? Thanks in advance for any idea you have, Marc Soleda
... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits
-
Hi all, I'm developing an application in VB2005.Net 2.0 and I would like to use a C header file that contains many structs that I need in the project. This structs are going to change quite often so I wouldn't like to migrate the structs from the C file to VB code each time that the header file changes. The best thing for me would be to include the '.h' file directly into my project so I could access it directly. Is it possible to do it in any way? Could it be possible to do it encapsulating the '.h' file into a library and then reference it from the VB project? Thanks in advance for any idea you have, Marc Soleda
... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits
Perhaps if you make a C++/CLI dll, you could do it.
Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
Perhaps if you make a C++/CLI dll, you could do it.
Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
I've done it but I just have access to the struct name and not to its subelements. I mean: In the .h header file:
.... public struct S_ERRORS{ unsigned char uHall2; unsigned char uHall1; } ...
Inside the VB project, I can declare a S_ERRORS variable but I cannot access to its element: uHall1, uHall2 Is there any way to access to this elements? Thanks in advance, Marc Soleda... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits
-
I've done it but I just have access to the struct name and not to its subelements. I mean: In the .h header file:
.... public struct S_ERRORS{ unsigned char uHall2; unsigned char uHall1; } ...
Inside the VB project, I can declare a S_ERRORS variable but I cannot access to its element: uHall1, uHall2 Is there any way to access to this elements? Thanks in advance, Marc Soleda... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits
Marc Soleda wrote:
I've done it
Done what?? Did you compile this into a MANAGED (C++ CLI) .DLL or into a normal Windows library .DLL (unmanaged code). If unmanaged, you won't be able to use the structures defined in the .DLL.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008 -
Marc Soleda wrote:
I've done it
Done what?? Did you compile this into a MANAGED (C++ CLI) .DLL or into a normal Windows library .DLL (unmanaged code). If unmanaged, you won't be able to use the structures defined in the .DLL.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008Into a C++/CLI dll: I can declare a structure variable defined in the library but no access to its elements
... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits