C++Builder Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
C++빌더 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
메신저 프로젝트
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
볼랜드포럼 광고 모집

C++빌더 Q&A
C++Builder Programming Q&A
[18559] Re:VC로 만든 dll을 import해서 사용하려는데..
화이트 [] 1388 읽음    2002-05-16 11:52
심심산천 님이 쓰신 글 :
: 게시판에서 비슷한 질문을 찾다가 없는거 같아 글을 올립니다.
:
: VC로 만든 sdk.dll(예)을 CBuilder에서 사용하려는데 컴파일러의 name mangling때문에
: 링크를 못하더군요.
: 만약 sdk.dll 소스가 있으면 CBuilder에 맞게 고쳐서 컴파일하면 되는데
: 업체에서 고쳐주지도 않고 소스를 보여줄리도 없고.. 여튼 불가능하기 때문에
: 헤더파일에 있는 public 함수들을 연결해주는 bridge.dll(예)을 Vc에서 ATL 프로젝트로 만들었습니다.
:
: bridge.dll을 CBuilder에서 import해서 사용하려는데
: 문제는 아래소스에서 E2370 simple type name expected라는 에러가 뜹니다.
: OnDeviceResponded 이벤트를 __closure 타입으로 정의하는데 함수인자에 기본타입이 아닌
: 사용자가 정의한 타입을 썼거든요..바로 bda[6]가 원래 dll에서 typedef로 정의한 것을
: builder가 만든 코드입니다.
: bda[6]을 쓰는 함수가 한두개도 아니고..
: 조언부탁드립니다..
:
: typedef void __fastcall (__closure * TBtIfOnDeviceResponded)(System::TObject * Sender,
:                                                            unsigned_char bda[6]/*[in]*/,
:                                                            unsigned_char devClass[3]/*[in]*/,
:                                                            unsigned_char bdName[248]/*[in]*/,
:                                                            long bConnected/*[in]*/);
:  
:
: class PACKAGE TBtIf : public Oleserver::TOleServer
: {
: ....
:
:   private:
:     TBtIfOnDeviceResponded         FOnDeviceResponded;
:  
: __published:
:
:   __property TBtIfOnDeviceResponded OnDeviceResponded={ read=FOnDeviceResponded, write=FOnDeviceResponded };
: }
:
:
: help에 보니깐 이렇게 나와있네요..

: To ensure interoperability between Delphi and C++Builder, there are restrictions on the type names mentioned in the parameter lists of published closure types. The parameter types have to be simple type names with optional const modifier and pointer or reference notation.
:
: So when declaring a closure type, the arguments passed to that closure must be of a simple type. For example, templates are not accepted. To pass a reference to an object of template type to a closure, you must declare a typedef, which counts as a simple type name.
:
: Example:
:
: struct __declspec(delphiclass) foo
:
: {
:      typedef void __fastcall (__closure *foo1)(SomeTemplateType<int> *);
:
:      typedef SomeTemplateType<int> SimpleTypeName;
:      typedef void __fastcall (__closure *foo2)(SimpleTypeName *);
:
: published:
:
:      __property foo1 prop1;  // Error
:      __property foo2 prop2;  // OK
: };
:
:
:
:

unsigned_char 정의가 안되있다면

typedef unsigned char unsigned_char;

이렇게 선언하면 될거 같고요 이것 보다는

System::TObject * 이게 의심스러운데
이걸 typedef 으로  정의해서 사용해보시죠

typedef System::TObject *  SystemObject;

이런식으로 정의해서 해보면 어떨가 싶네요


+ -

관련 글 리스트
18556 VC로 만든 dll을 import해서 사용하려는데.. 심심산천 1031 2002/05/16
18559     Re:VC로 만든 dll을 import해서 사용하려는데.. 화이트 1388 2002/05/16
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.