Interoperation of C# application and C++ DLLs

Recently in C# .NET project, extra C++ modules were needed to provide some services. For the inter-module communication between C# and C++, P/Invoke method was chosen because it’s quick.

In the development machine, nothing particular happened in debugging session. But in release mode and in a demo. computer, it started to produce many unexpected results.

I found that Visual Studio IDE does not provide a relevant wizard. Everything is left to a developer to arrange various settings here and there. I believe those efforts are not related to the intrinsic function of the target software, but the efficiency of IDE itself.

However we cannot neglect this point as it usually takes a lot of time in such kind of projects. This memo is for developers including myself to save time in similar projects in future.

 

I. Backgrounds

1.Module Design

a.Main program: C#;

b.Special functions: C++ DLLs;

c.Interface: P/Invoke;

2.Technical Environment

a.Development: Windows 10;

b.IDE:                  VS2015 Community Edition;

c.Demo. Computer: Windows 8.1;

II.Problems

C++ DLLs function well in the debugger mode in IDE. But since in the release mode, they made errors as follows,

1.”Unresolved external symbols, __imp__CreationFontW” error came out, in build phase;

2.”Unable to load DLL: could not find”, in execution at the demo computer;

III. Analysis

1.”Unresolved Symbols” in Build Phase

IDE needs libraries which have entries available to the C++ source;

2.”Unable to Load DLL: Could Not Find”

The application is trying to load DLLs to fail because of platform mismatch or bad image format. Therefore it is necessary to make the DLL fit to the target platform and run standalone.

IV. Solution

1.For the C++ DLL in development platform

a.In IDE solution explorer, have the project  to retarget SDK version (in my case 8.1);

b.In the project properties, set

(1)Configuration to “Release”;

(2)Platform to “Active(win32)”;

(3)At Configuration Manager:

(a)Active Solution Configuration: “Release”;

(b)Active Solution Platform: “Win32”;

(c)At Project Context:

– Configuration: “Release”;

– Platform: “Win32”;

– Build: Checked;

(4)C/C++  >  Code Generation  >  RunTime Library to “/MT”;

(5)Linker  >  Additional Dependency to the libraries which contain entries from the unresolved external symbols (ex: gdi32.lib);

c.Build;

d.Repeat the above settings for another DLLs, if any;

e.If checking the DLLs in the Dependency Walker, it may shows the CPU x86 while others are x64. Don’t care;

2.For the C# main project.

a.Include the above built DLL files into the main project;

b.Set their “Copy to Output Directory” property to “Copy Always”;

c.Set the main project’s property “Allow unsafe code” to true, if necessary;

d. Publish;

e. Install the application in the demo computer;

V. Conclusion

The solution may vary case by case. In my case, the above solution shot all the problems. My demo system works great even with SQL server 2014.

For this, I rummaged http://stackoverflow.com, http://experts-exchange.com, http://software.intel.com and http://msdn.com of course as well.

Leave a Comment

Filed under News

Peter Plumbing Assoc., Inc.

We are very happy to finish the renovation project of http://pplumbings.com.

The owner, Peter Plumbing is one of the dependable plumbing companies in New York as well as New Jersey. Their business line includes, but not limited to, constructions, government regulatory inspections, boiler installation/conversion and fire sprinkler systems.

The company is led by a Master Plumber with public confidence, where the license is very prestigious in field of plumbing engineering in U.S.

All-That corp. is proud of the client satisfaction with the website project and hopes to go together in the long run.

Take a look at http://peterplumbing.com. This website, we believe, will be the cornerstone of marketing activities.

Cheers!

Comments Off on Peter Plumbing Assoc., Inc.

Filed under News

Master of OS

 

Recently, new operating systems came up on the technology theatre.

It is the fact, these days, that people can choose other operating systems. To name a few, Windows, OS X, Linux, iOS, Android and Tizen OS from Samsung.

In earlier days, AT&T, GE and renowned technolgy leaders had joined in the Multics project in MIT to develop an innovative operating system. Actually some participants dropped in the middle without obvious achievements due to the budget crunch.

The engineers returned back to their position in AT&T Bell Lab., took the key ideas from Multics to spawn a new operating system called Unix and C programming language. The name Unix hints the origin is Multics. And they opened the source to the public to generate so many advocates around the world.

Premium at no cost!

The world was on fire. It was natural all global computers were trying to install Unix for their OS.

For decades, Unix has grown up to mutate itself into brothers like HP-UX, Solaris and AIX, 99% same in functions, but they are not free anymore.  Unix advocates lost the ground.

Linux is open source again. In a web server project, I found that Linux is same with Unix in blood and fast as Unix, and last but not least, free again.

Google launched Android for open source. I heard that Android takes the Linux as its kernel, which is the intrinsic part of OS.  Currently Android is occupying only mobile platform area, but expanding its territory to specialty areas, like TV, Auto and Wear.

OS is the platform in computer world. If someone takes the OS, he/she starts game on a absolutely advantageous footing.

Guess! In 10 years, who will be the master of OS?

 

Sun Kim

Comments Off on Master of OS

Filed under News

Why SSH?

Today is the age of specialization and cooperation.

Sometimes, I feel the level of specialization could be a criteria to distinguish the advanced group from the lagging group.

Working on the web based contents management projects, I am used to make tasks into 3 groups to push for organized development. The first one is a content management system like the WordPress or the Drupal which is sort of an open source. The next would be the design for artistic appearance and functional advantage. The last but not least important is the web server itself, for example,Unix, Windows Server or whatever in practice.

In terms of technical influence in Internet project, web servers take the top position for it is a kind of ground which provides everything to one on it. Certain web developers rarely notice the limitation imposed by their web server. Frustrated, they changed their codes forever to give up the project. That’s why I pay attention to the web server performance and functionality.

For web server engineering, there is a single gate to pass in, SSH or Secure Shell. SSH is one of the official tools. It provides me with a cryptographic network protocol. Using it, I can give commands to my web server over the Internet. Without SSH, web developers usually use the FTP or sFTP which is different from the SSH. FTP just mimics the tiny portion of SSH operation.

Nevertheless, most web developers could not use SSH for two reasons. It takes long time to learn. That’s OK. The real problem is the web hosting company reluctant to open the gate.

For last 2 weeks, I wasted time to open the gate of SSH at one of the largest web hosting company in states. When I asked for SSH, they agreed to upgrade my web hosting service. After upgrade, they again suggested me to use the FTP only.

Hmmm! With SSH, I can use the wget command to download 7MB file in 1-3 seconds. With FTP, it usually takes me cumbersome 2 steps in 5-30 minutes.

I insisted SSH. Call transfer after call transfer, I talked to several staffs. But it does not work. They seem to announce they are not blocking my SSH. If I ask in detail, they answered “No idea”.

They started to suspect my network problem. I explained them my SSH works good for another web hosting service. But they answered it does not help my request. They insisted they have no problem.

They never say they are blocking my SSH connection.

 

Comments Off on Why SSH?

Filed under News

C# and DropBox

These days, DropBox(TM) is one of the hot potatoes in technology world.

It enables us to share and communicate data without the need of complicated technical platform.
Recently, the C# language joins in the API groups even though the developmental information looks not enough.

For reliable interface to dropbox folders and files, I need API. They say that SharpBox is good for C# developers, but it seems outdated since 2 years ago. DropboxRestAPI could be another. Till now I have no idea of difference among them.

Through trial-and-error, I found the fact that

  • the old IDE VS2010 Express should be upgraded to VS2015;
  • .NET framework also need to be v.4.5;
  • Package Manager Console must be used in IDE to install the API package;
In case of VS2012, Package Manager Console failed to find the Dropbox.api. Instead, Manage NuGet Packages menu found the Dropbox v2 API Beta to install successfully, which should be figured out the difference between them later.

Once successfully installed DropBox API, what will be the next?

Comments Off on C# and DropBox

Filed under News

Intake Download

Download an INTAKE_form

 

 

Comments Off on Intake Download

Filed under News

Successful Launch of UB_04 generation System in SR Homecare of NY

Tomorrow is the thanksgiving day of 2015. So, SR Homecare of NY, the home care company seems to be happy to give me a gift.

They managed to install successfully

  • the UB_04 billing system where C# and iTextSharp libraries were widely employed;
  • the automatic face cropping utility where C# and EMGU facilities were utilized.

I am sure that they could cut the related labor cost about  to the half of present.

See Letter of Appreciation

 

Comments Off on Successful Launch of UB_04 generation System in SR Homecare of NY

Filed under News

Prestashop – Extending the Credit Card Expiration Date

 

A company called in my office for a help. They have a website based on the Prestashop, the free eCommerce software. Long time ago, a web master downloaded it to build an Internet shopping mall which starts to make a problem recently.

The problem is

  • a customer has a credit card with expiration date of 2020;
  • the website provides the expiration date up to 2019;
  • and they do not have a web master anymore;

Since they wanted a hotfix, I walked straight into their web server and found

  • a Smarty template is employed in the system;
  • “authorizeaim.tpl” is the target template file which is shown below;

Source code of template

 

In Smarty, the “loop” variable in {section} function is designed to provide the specified value minus one as a maximum value. Therefore, in the above case, the end year would be 2019 because the “loop” variable is “20”.

Now, all we have to do in this errand is to change the “loop” value from “20” to “25” and it will extend the last expiration year to 2024.

 

Voila, it works!

 

 

Comments Off on Prestashop – Extending the Credit Card Expiration Date

Filed under News

Computer Beginners’ Workbook for Korean Seniors

Recently we published a computer book which is being used as a workbook in the computer beginners’ class in New York Adult Day Care Center. The target reader of the book is the Korean seniors who

  • have little knowledge of computer systems and computer utilization;
  • want to learn a personal computer skills;
  • live in United States;
Cover Design

Cover Design of Book

The key design concept of this book is a drill-down of the essential topics. At first, not-so-many essential topics are selected that seniors may concentrate on the topics without mess-up. Then the topics are broken down into subordinate knowledge/skills to get the balanced knowledge trees. This scheme of lessons are given to seniors by systematic step-by-step approaches day by day.

  • Size: 238 pages;
  • Binding: Paperback;
  • ISBN-13: 978-0991587407;

This book could be ordered at Amazon.com

Comments Off on Computer Beginners’ Workbook for Korean Seniors

Filed under News

Hello 2014!

How are you!

In New York, we are happy to see everyone holding a smart phone or using a computer tablet these days.

Today, something changed. The most popular recruit method is no more a newspaper, it’s Internet websites. Many offline stores closed their business because lots of customers prefer a shopping at Internet mall. End users are already getting into the wave of Networked Information (NI).

As we look at the spectrum of Information Technology (IT) utilization in New York City small businesses, however, we admit that major computer power consumers still stay in IT revolution phase which is the previous stage of NI.

For those consumers, we have proudly played a small role of education, programming and helping others. We participated in

  • teaching in computer class;
  • publishing the absolute beginners’ computer workbook;
  • development of various websites;
  • programming of business software;
In technology, we take client’s difficulties very seriously. We are able to bring our standards to clients’ level and keep a low profile against our clients. We believe that’s what the most clients expect in our professional service.
Use our expertise for your success!
Sun Kim

Comments Off on Hello 2014!

Filed under Home