473,809 Members | 2,617 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

defining entry point (main) in an external static lib for a CLRexecutable

Hello,

With non CLR C++ I am used to have a static library (MyMain.lib) which
defines the main entry points depending on the plateform (windows,
unix, mac os x, ps3, ...). We are planning to develop some executable
using CLR (managed C++ mixed with non managed C++). So I decide to add
a new entry point to my lib.

I have something like this :

#if defined(MSVC_MA NAGED)

int main(array<Syst em::String ^^args)
{
error err = eOk;
err = MyMain(args);
return err;
}

#endif

I have a project (MyExe) which create a CLR executable. This project
define the function MyMain and link with MyMain.lib which define the
main function. But the linker failed saying it can find the entry
point. I did not understand why because the entry point is defined in
a library and I link with it.

Perhaps static libraries behave in a different way in CLR mode.
Someone got an idea about my problem ?
Jun 27 '08 #1
1 3903
ni************@ gmail.com wrote:
Hello,

With non CLR C++ I am used to have a static library (MyMain.lib) which
defines the main entry points depending on the plateform (windows,
unix, mac os x, ps3, ...). We are planning to develop some executable
using CLR (managed C++ mixed with non managed C++). So I decide to add
a new entry point to my lib.

I have something like this :

#if defined(MSVC_MA NAGED)

int main(array<Syst em::String ^^args)
{
error err = eOk;
err = MyMain(args);
return err;
}

#endif

I have a project (MyExe) which create a CLR executable. This project
define the function MyMain and link with MyMain.lib which define the
main function. But the linker failed saying it can find the entry
point. I did not understand why because the entry point is defined in
a library and I link with it.

Perhaps static libraries behave in a different way in CLR mode.
Someone got an idea about my problem ?
Have you tried just using the conventional definition of

int main(int, char**)

?

Anyway, the correct macro to test would be __cplusplus_cli instead of
MSVC_MANAGED.
Jun 27 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1565
by: Cplusplus | last post by:
as C++ defaults to external linkage for non-consts and non-static(right?): Qn) why is it then : a object declared (*without* static keyword)outside main() and outside all functions , automatically considered a static object ?. doesn't static mean its internal linkage? accding me if u define a object like this then A should be external linkage. Obj A('a'); // Global int main()
2
4729
by: Dave | last post by:
This morning I copied a C# console project file I was working on over the week-end to my workstation and tried to run it. I got the message: Program 'C:\Visual Studio\myProj.exe' does not have an entry point defined My code looks like this: using System; using System.Reflection;
1
1624
by: I am Sam | last post by:
Hi Everyone, I am new to Server control development and I am wondering how do I define the entry point for a server control? In a regular page you define Page_Load as an entry point and in a windows application using C# you define the entry point as void Main(){}. But in a Server control I think it is seperate then writing the entry point as static void Main(){}
7
9644
by: Mythran | last post by:
Hmm, just for my test applications, I want to create a dll that has a class: public class MyTest { public void Main(string Args) { ... blah ... } }
5
3157
by: Mike in Santa Rosa | last post by:
I'm trying to get a simple c# app built that can launch/manipulate an excel workbook, sheet. I've chased down several examples and can't any of them to work. So I must be doing somethnig obviouslt wrong. Most examples to get things started include something: using Microsoft.Office.Interop.Excel; or using Excel; or using Excel = Microsoft.Office.Interop.Excel;
2
6833
by: bboule | last post by:
Hi I have developped a dll that I want to use in another program ! here is my code : using System; using System.Collections.Generic; using System.Text; namespace NameSpace
3
2996
by: Chris Portka | last post by:
How can I modify static variables from outside the class they're defined in? It doesn't work if I try to access them from a function, from an instantiated object, or from the class itself. Here's an example: MAIN: #include "test" int main() { Test t;
8
2797
by: George2 | last post by:
Hello everyone, For entry point of a console application, http://msdn2.microsoft.com/en-us/library/f9t8842e(VS.71).aspx My understanding is it is important that the name of the function main exists, and it does not matter the prototype of main function, for example,
11
2930
by: whirlwindkevin | last post by:
I saw a program source code in which a variable is defined in a header file and that header file is included in 2 different C files.When i compile and link the files no error is being thrown.How is this possible.I thought it will throw "Variable redefinition Error". Giving the source code for reference.Please help me out on this... a.h ----- int g; void fun(void);
0
9603
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10640
Oralloy
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...
0
10376
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10120
tracyyun
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...
0
9200
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6881
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();...
0
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4332
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
3
3015
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.