I have a API lib (written in C/C++) that can be used by C/C++ project.
Now, I'm adding support to C# project.
I changed the Lib to DLL. This is easy. However, I have no idea how to
deal with the structures and constants that used to be defined in the
header file of the lib.
Where should I define them that they can be commonly used by the DLL, C
++ and C#, and also is readable to their developers from their IDEs?
Thanks!
-Dev 3 7910
On Mar 16, 9:09 am, "Dv" <dev...@gmail.c omwrote:
I have a API lib (written in C/C++) that can be used by C/C++ project.
Now, I'm adding support to C# project.
I changed the Lib to DLL. This is easy. However, I have no idea how to
deal with the structures and constants that used to be defined in the
header file of the lib.
Where should I define them that they can be commonly used by the DLL, C
++ and C#, and also is readable to their developers from their IDEs?
Thanks!
-Dev
I think I understand the question. By default, the C# engine will know
how to comile your existing function calls, constants, etc based on
the DLL.
However, if you want those constants to pop up in the intellisense
menus, then you may be pushing your luck. It won't auto-load them into
Intellisense for you.
Instead, you may want to create new declarations in C# as constants
that mimic your C++ constants. The problem is that now you have two
sets of "constants" to maintain.
Hope that helps.
--Sim
On Mar 16, 10:32 am, "SimeonArgu s" <simeontr...@gm ail.comwrote:
On Mar 16, 9:09 am, "Dv" <dev...@gmail.c omwrote:
I have a API lib (written in C/C++) that can be used by C/C++ project.
Now, I'm adding support to C# project.
I changed the Lib to DLL. This is easy. However, I have no idea how to
deal with the structures and constants that used to be defined in the
header file of the lib.
Where should I define them that they can be commonly used by the DLL, C
++ and C#, and also is readable to their developers from their IDEs?
Thanks!
-Dev
I think I understand the question. By default, the C# engine will know
how to comile your existing function calls, constants, etc based on
the DLL.
However, if you want those constants to pop up in the intellisense
menus, then you may be pushing your luck. It won't auto-load them into
Intellisense for you.
Instead, you may want to create new declarations in C# as constants
that mimic your C++ constants. The problem is that now you have two
sets of "constants" to maintain.
Hope that helps.
--Sim
Sim, thanks for your reply! No, I didn't mean the Intellisense. I
meant a text file (instead of a binary file, such as DLL) that is
displayable in IDE with all the structures and constants defined in
there.
I expect that users of my DLL could reuse the declarations coming with
the DLL either in the form of header file or some other way that's
acceptable by both C++ and C#.
Dv,
You can't. You have to declare the structures that the functions use in
C#. Your best bet would be to declare them in the assembly that utilizes
the DLL functions in C#.
You can not use the same header file in C++ as you do in C#, and
vice-versa.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"Dv" <de****@gmail.c omwrote in message
news:11******** **************@ d57g2000hsg.goo glegroups.com.. .
>I have a API lib (written in C/C++) that can be used by C/C++ project.
Now, I'm adding support to C# project.
I changed the Lib to DLL. This is easy. However, I have no idea how to
deal with the structures and constants that used to be defined in the
header file of the lib.
Where should I define them that they can be commonly used by the DLL, C
++ and C#, and also is readable to their developers from their IDEs?
Thanks!
-Dev This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: mescaline |
last post by:
Hi,
Suppose a_file.cpp contains a function a_function()
Now to include it in main_file.cpp I just do #include "a_file.cpp" and
I'm all set.
i recently came across this seemingly roundabout way to do this in 3
steps:
1. Add in main_file.cpp
|
by: Rakesh |
last post by:
Hi,
I was writing this C++ program wherein I used an include statement
like -
#include <iostream.h>
I was told by my co-worker that this form of including a file is
deprecated and should not be used, instead it ought to be something
like
|
by: Ramesh |
last post by:
Hi,
I am currently maintaining a legacy code with a very very large code base.
I am facing problems with C/C++ files having a lot of un-necessary #includes.
On an average every C/C++ file has around 150+ .h files included. I find 75%
of the files unnecessary and could be removed. Considering the fact that I
have a huge code base, I can't manually fix it.
Are there any tools that would report un wanted .h files?
|
by: Tuckers |
last post by:
My question is, if I have created my own library which lives in its own
install directory, to refer to its header file is it better to use
#include "MyLibrary.h"
or
#include <MyLibrary.h>
Assume that this library will be used by other groups. I think the answer
|
by: Derrick Coetzee |
last post by:
It seems like, in every C source file I've ever seen, there has been a
very definite include order, as follows:
- include system headers
- include application headers
- include the header associated with this source file
For example, in a file hello.c:
#include <stdio.h>
| |
by: bill |
last post by:
Forget the exact definition of difference between,
#include <foo.h>
and
#include "bar.h"
Normally foo.h is a standard header file, so it's path is not defined
in compiler option, but I am curious how compiler find it.
|
by: Neil Cerutti |
last post by:
In Rob Pike's style guide he urges the following:
Simple rule: include files should never include include
files. If instead they state (in comments or implicitly)
what files they need to have included first, the problem of
deciding which files to include is pushed to the user
(programmer) but in a way that's easy to handle and that,
by construction, avoids multiple inclusions.
I was startled by this guideline, since...
|
by: Jon Rea |
last post by:
I am currently cleaning up an application which was origainlly hashed
together with speed of coding in mind and therefore contains quite a few
"hacky" shortcuts.
As part of this "revamping" process I am introducing namespaces to
properly compartmentalise sections of the code into logical units. What
I am speciffically trying to get right is the dependency tree for header
files to reduce compile time and simplify the code structure.
On...
|
by: key9 |
last post by:
Hi all
look at the organize tree
main.c
------
#include lib_adapter.c
main()
{
foo();
|
by: The Cool Giraffe |
last post by:
One thing i do know for sure. When one creates a CPP file,
one needs to include the H file. Now, having said that, i
wonder if there are some general hints, requirements or
standard guide lines on what and how to include.
Suppose that we have a project consisting of a number of
classes and structs. Some of them using the others, some
using all of them. What is a good approach when including?
--
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |